@param int    $id
@param string $contentType
@param string $field

@return Entity[]
351341
public function getExistingFields($id, $contentType, $field)
    {
        $query = $this->queryExistingFields($id, $contentType, $field);
        $results = $query->execute()->fetchAll();

        $fields = [];

        if (!$results) {
            return $fields;
        }

        foreach ($results as $result) {
            $fields[$result['grouping']][] = $result['id'];
        }

        return $fields;
    }
818318
protected function getExistingKeywords($keywordList, $contentTypeId)
    {
        $dbHandler = $this->getConnection();

        // Retrieving potentially existing keywords
        $q = $dbHandler->createSelectQuery();
        $q->select('id', 'keyword')
            ->from($dbHandler->quoteTable('ezkeyword'))
            ->where(
                $q->expr->lAnd(
                    $q->expr->in(
                        'keyword',
                        $keywordList
                    ),
                    $q->expr->eq('class_id', $contentTypeId)
                )
            );
        $statement = $q->prepare();
        $statement->execute();

        $existingKeywordMap = array();

        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;
    }
1227416
protected function contentTypeHasFieldDefinition(ContentType $contentType, $fieldIdentifier)
    {
        $existingFieldDefinitions = $contentType->fieldDefinitions;

        foreach ($existingFieldDefinitions as $existingFieldDefinition) {
            if ($fieldIdentifier == $existingFieldDefinition->identifier) {
                return $existingFieldDefinition;
            }
        }

        return null;
    }
965401
protected function getAllMultiViewRecords($contentTypeName = null, DataDimensions $dataDimensions)
    {

        $data = $this->readRecords($this->getConfiguration()->getUriRecords($contentTypeName));

        if ($data)
        {
            $data = json_decode($data, true);

            $data['records'] = array_filter($data['records']);

            $definition = $this->getContentTypeDefinition($contentTypeName);

            $records = $this->getRecordFactory()
                            ->createRecordsFromJSONRecordsArray($definition, $data['records']);

            return $records;
        }

        return [ ];

    }
214149
public function getFieldGroupValuesForContent(ContentInterface $content = null, $slug)
    {
        if (null === $content) {
            return [];
        }

        foreach ($content->getFieldValues() as $fieldValue) {
            if ($fieldValue->getField()->getSlug() == $slug) {
                return $fieldValue->getChildren();
            }
        }
        return [];
    }
1107837
private function getContentSubdocuments(Content $content)
    {
        if ($this->contentSubdocumentMapper->accept($content)) {
            return $this->contentSubdocumentMapper->mapDocuments($content);
        }

        return [];
    }
979900
public function getFieldById(ContentTypeInterface $contentType, $fieldId)
    {
        $field = $this->om->getRepository($this->configurationManager->getEntityClass('field'))->find($fieldId);


        if (!$field instanceof FieldInterface) {
            return null;
        }
        if ($field->getContentType() && $field->getContentType()->getId() == $contentType->getId()) {
            return $field;
        }

        $parent = $field;
        while ($parent && $parentLayout = $parent->getLayout()) {
            if ($parent = $parentLayout->getParent()) {
                if ($parent->getContentType() !== null && $parent->getContentType()->getId() == $contentType->getId()) {
                    return $field;
                }
            }
        }

        return null;
    }
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;
    }
930755
public function decode(string $data, string $contentType): array
    {
        if (isset($this->decoderTypes[$contentType])) {
            return $this->decoderTypes[$contentType]->decode($data);
        }

        throw DeserializerLogicException::createMissingContentType($contentType);
    }
996590
private function getFieldDescriptors($entityName, $id)
    {
        if (null === $this->fieldDescriptors) {
            $this->initFieldDescriptors($entityName, $id);
        }

        return $this->fieldDescriptors;
    }
1126717
public function createByTypeAction($id, Request $request)
    {
        $contentType = $this->contentTypeManager->getContentTypeById($id);

        if ($contentType === null) {
            throw EntityNotFoundException::fromClassNameAndIdentifier(
                $this->configurationManager->getEntityClass('content_type'),
                [$id]
            );
        }

        $contentEntityClass = $this->configurationManager->getEntityClass('content');
        $content = new $contentEntityClass;
        $content->setContentType($contentType);

        $form = $this->createForm(ContentType::class, $content, [
            'action' => $this->generateUrl('sherlockode_acb_content_create_by_type', ['id' => $contentType->getId()]),
            'contentType' => $content->getContentType(),
        ]);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $this->om->persist($content);
            $this->om->flush();

            return $this->redirectToRoute('sherlockode_acb_content_edit', ['id' => $content->getId()]);
        }

        return $this->render('@SherlockodeAdvancedContent/Content/edit_content.html.twig', [
            'form' => $form->createView(),
            'is_ajax' => $request->isXmlHttpRequest(),
        ]);
    }
879473
protected function getFieldIds($contentId, array $fieldIdentifiers)
    {
        $ids = [];
        foreach ($fieldIdentifiers as $identifier) {
            try {
                $ids[] = $this->contentTypeUtils->getFieldId($contentId, $identifier);
            } catch (OutOfBoundsException $e) {
                continue;
            }
        }

        return $ids;
    }
937740
public function findByEncryptedId($id, $field = 'id') 
	{
	    $hashids = $this->getServiceLocator()->get('neobazaar.service.hashid');
	    $id = $hashids->decrypt($id);
	    $id = is_array($id) ? reset($id) : $id;
	    
        $options = array(); 
        $qb = $this->_em->createQueryBuilder();
        $qb->select(array('a'));
        $qb->from($this->getEntityName(), 'a');
        $qb->where($qb->expr()->eq('a.' . $field, ':value'));
        $qb->setParameter('value', $id);
        $result = $qb->getQuery()->getResult();
        
        return reset($result);
	}
292539
public function getSelectList(array $contentType, $order, $neededFields = [])
    {
        $query = $this->querySelectList($contentType, $order, $neededFields);

        return $query->execute()->fetchAll();
    }
1035899
protected function getConfigForContentType(ContentType $contentType)
    {
        if ($this->hasConfigForContentType($contentType)) {
            return $this->config['override_by_type'][$contentType->identifier];
        }

        return [];
    }
395
protected function extractMediasFromContentType(ContentTypeInterface $contentType)
    {
        $mediaIds = array();
        $fields = $contentType->getFields();

        foreach ($fields as $field) {
            if ($this->isMediaAttribute($field->getDefaultValue())) {
                $mediaIds[] = $field->getDefaultValue()['id'];
            }
        }

        return $mediaIds;
    }
624713
public function getContentTypeFields($contenttypeslug)
    {
        $contenttype = $this->getContentType($contenttypeslug);

        if (empty($contenttype['fields'])) {
            return [];
        } else {
            return array_keys($contenttype['fields']);
        }
    }