Returns already existing keywords from $keywordList as a map.

The map has the following format:
<code>
array(
'<keyword>' => <id>,
// ...
);
</code>

@param string[] $keywordList
@param int $contentTypeId

@return int[]
173871
protected function getExistingKeywords($keywordList, $contentTypeId)
    {
        // Retrieving potentially existing keywords
        $query = $this->connection->createQueryBuilder();
        $query
            ->select(
                $this->connection->quoteIdentifier('id'),
                $this->connection->quoteIdentifier('keyword')
            )
            ->from($this->connection->quoteIdentifier(self::KEYWORD_TABLE))
            ->where(
                $query->expr()->andX(
                    $query->expr()->in(
                        $this->connection->quoteIdentifier('keyword'),
                        ':keywordList'
                    ),
                    $query->expr()->eq(
                        $this->connection->quoteIdentifier('class_id'),
                        ':contentTypeId'
                    )
                )
            )
            ->setParameter(':keywordList', $keywordList, Connection::PARAM_STR_ARRAY)
            ->setParameter(':contentTypeId', $contentTypeId);

        $statement = $query->execute();

        $existingKeywordMap = [];
        foreach ($statement->fetchAll(\PDO::FETCH_ASSOC) as $row) {
            // filter out keywords that aren't the exact match (e.g. differ by case)
            if (!in_array($row['keyword'], $keywordList)) {
                continue;
            }
            $existingKeywordMap[$row['keyword']] = $row['id'];
        }

        return $existingKeywordMap;
    }
1007954
public function queryExistingFields($id, $contentType, $field)
    {
        $query = $this->createQueryBuilder()
            ->select('grouping, id', 'name')
            ->where('content_id = :id')
            ->andWhere('contenttype = :contenttype')
            ->andWhere('name = :name')
            ->orderBy('grouping', 'ASC')
            ->setParameters([
                'id'          => $id,
                'contenttype' => $contentType,
                'name'        => $field,
            ]);

        return $query;
    }
1318856
protected function getChoices($contentType, $operator, $keywords)
    {
        $choices = array();

        $language = $this->contextManager->getSiteDefaultLanguage();
        $siteId = $this->contextManager->getSiteId();
        $contents = $this->contentRepository->findByContentTypeAndCondition($language, $contentType, $operator, $keywords, $siteId);

        foreach ($contents as $content) {
            $choices[$content->getId()] = $content->getName();
        }

        return $choices;
    }
85242
public function findByKeywords(array $keywords, array $modCombinationIds = []): array
    {
        $result = [];
        if (count($keywords) > 0) {
            $queryBuilder = $this->entityManager->createQueryBuilder();
            $queryBuilder->select('i')
                         ->from(Item::class, 'i');

            $index = 0;
            foreach ($keywords as $keyword) {
                $queryBuilder->andWhere('i.name LIKE :keyword' . $index)
                             ->setParameter('keyword' . $index, '%' . addcslashes($keyword, '\\%_') . '%');
                ++$index;
            }

            if (count($modCombinationIds) > 0) {
                $queryBuilder->innerJoin('i.modCombinations', 'mc')
                             ->andWhere('mc.id IN (:modCombinationIds)')
                             ->setParameter('modCombinationIds', array_values($modCombinationIds));
            }

            $result = $queryBuilder->getQuery()->getResult();
        }
        return $result;
    }
418002
public function getAllLocationIds($contentId)
    {
        try {
            return $this->innerGateway->getAllLocationIds($contentId);
        } catch (DBALException $e) {
            throw new RuntimeException('Database error', 0, $e);
        } catch (PDOException $e) {
            throw new RuntimeException('Database error', 0, $e);
        }
    }
430995
private function getNewContentTypeDraft(ContentType $contentType)
    {
        try {
            $contentTypeDraft = $this->contentTypeService->loadContentTypeDraft($contentType->id);
        } catch (NotFoundException $e) {
            $contentTypeDraft = $this->contentTypeService->createContentTypeDraft($contentType);
        }

        return $contentTypeDraft;
    }
738360
public function getContentTypeDefinition($contentTypeName = null)
    {

        if ($contentTypeName == null) {
            $contentTypeName = $this->getCurrentContentTypeName();
        }

        return $this->readConnection->getContentTypeDefinition($contentTypeName);
    }
1182692
public function get($contentTypeIndex): ContentCollection
    {
        $url = $this->projectApiEndpoint.'/types/'.$contentTypeIndex;

        $response = $this
            ->adapter
            ->get($url);

        return (new ContentCollection(json_decode($response)->data))
            ->map(function ($item) {
                return new ContentModel((array) $item);
            });
    }
401426
public function loadContentTypeDraft($contentTypeId)
    {
        $contentTypeDraft = $this->contentTypeService->loadContentTypeDraft($contentTypeId);

        return new Values\RestContentType(
            $contentTypeDraft,
            $contentTypeDraft->getFieldDefinitions()
        );
    }
828037
public function applyUpdates($contentTypeId, array $actions)
    {
        if (empty($actions)) {
            return;
        }

        foreach ($this->getContentIdsByContentTypeId($contentTypeId) as $contentId) {
            foreach ($actions as $action) {
                $action->apply($contentId);
            }
        }
    }
401502
public function contentfulContentTypeName(string $contentTypeId): string
    {
        $contentType = $this->contentful->getContentType($contentTypeId);
        if (!$contentType instanceof ContentType) {
            return '';
        }

        return $contentType->getName();
    }
1147610
public function apply($contentId)
    {
        $versionNumbers = $this->contentGateway->listVersionNumbers($contentId);
        $fieldIdSet = array();

        $nameRows = $this->contentGateway->loadVersionedNameData(
            array_map(
                function ($versionNo) use ($contentId) {
                    return array('id' => $contentId, 'version' => $versionNo);
                },
                $versionNumbers
            )
        );

        foreach ($versionNumbers as $versionNo) {
            $contentRows = $this->contentGateway->load($contentId, $versionNo);
            $contentList = $this->contentMapper->extractContentFromRows($contentRows, $nameRows);
            $content = $contentList[0];
            $versionFieldIdSet = array();

            foreach ($content->fields as $field) {
                if ($field->fieldDefinitionId == $this->fieldDefinition->id) {
                    $fieldIdSet[$field->id] = true;
                    $versionFieldIdSet[$field->id] = true;
                }
            }

            // Delete from external storage with list of IDs per version
            $this->storageHandler->deleteFieldData(
                $this->fieldDefinition->fieldType,
                $content->versionInfo,
                array_keys($versionFieldIdSet)
            );
        }

        // Delete from internal storage -- field is always deleted from _all_ versions
        foreach (array_keys($fieldIdSet) as $fieldId) {
            $this->contentGateway->deleteField($fieldId);
        }
    }
1204699
public function loadContentTypeDraftFieldDefinitionList($contentTypeId)
    {
        $contentTypeDraft = $this->contentTypeService->loadContentTypeDraft($contentTypeId);

        return new Values\FieldDefinitionList(
            $contentTypeDraft,
            $contentTypeDraft->getFieldDefinitions()
        );
    }
268608
private function getContentItems($contentTypeId, array $options)
    {
        $offset = $options['page'] * $options['pageSize'] - $options['pageSize'];
        $criteria = $this->generateCriteria($contentTypeId, $options);

        $query = new Query();
        $query->query = new Criterion\LogicalAnd($criteria);
        $query->limit = (int)$options['pageSize'];
        $query->offset = $offset;

        return $this->searchService->findContent(
            $query,
            (!empty($options['lang']) ? array('languages' => array($options['lang'])) : array())
        )->searchHits;
    }
993771
public function copyContentType($contentTypeId)
    {
        $copiedContentType = $this->contentTypeService->copyContentType(
            $this->contentTypeService->loadContentType($contentTypeId)
        );

        return new Values\ResourceCreated(
            $this->router->generate(
                'ezpublish_rest_loadContentType',
                array('contentTypeId' => $copiedContentType->id)
            )
        );
    }
1277073
private function prepareFields(ApiContentType $contentType, $fields = null)
    {
        if ($fields !== null) {
            if (strpos($fields, ',') !== false) {
                return explode(',', $fields);
            }

            return array($fields);
        }

        $fields = array();
        $contentFields = $contentType->getFieldDefinitions();

        foreach ($contentFields as $field) {
            $fields[] = $field->identifier;
        }

        return $fields;
    }
1327412
protected function getParents($contentId, $blockTypeId)
    {
        $content = $this->content->findOrFail($contentId);
        $blockType = $this->blockTypes->findOrFail($blockTypeId);

        return compact('content', 'blockType');
    }