private function createJoin(string $alias, string $field, string $joinType): string
    {
        $relationship = $alias . '.' . $field;
        $key = $relationship . '.' . $joinType;

        if (!isset($this->uniqueJoins[$key])) {
            $joinedAlias = $this->uniqueNameFactory->createAliasName($field);

            if ($joinType === 'innerJoin') {
                $this->queryBuilder->innerJoin($relationship, $joinedAlias);
            } else {
                $this->queryBuilder->leftJoin($relationship, $joinedAlias);
            }

            // TODO: For now we assume the query will always access some field on the relation, so we optimize SQL by
            // fetching those objects in a single SQL query. But this should be revisited by either exposing an option
            // to the API so the client could decide to select or not the relations, or even better to detect in GraphQL
            // query if it's actually used or not.
            $this->queryBuilder->addSelect($joinedAlias);

            $this->uniqueJoins[$key] = $joinedAlias;
        }

        return $this->uniqueJoins[$key];
    }