@param $contentTypeIdentifier
@param array $collectedFields

@return BinaryFile[]|null
501027
protected function resolveAttachments($contentTypeIdentifier, array $collectedFields)
    {
        if (empty($this->config[ConfigurationConstants::ATTACHMENTS])) {
            return null;
        }

        if (array_key_exists($contentTypeIdentifier, $this->config[ConfigurationConstants::ATTACHMENTS][ConfigurationConstants::CONTENT_TYPES])) {
            $send = $this->config[ConfigurationConstants::ATTACHMENTS][ConfigurationConstants::CONTENT_TYPES][$contentTypeIdentifier];
        } else {
            $send = $this->config[ConfigurationConstants::ATTACHMENTS][ConfigurationConstants::SETTINGS_DEFAULT];
        }

        if (!$send) {
            return null;
        }

        return $this->getBinaryFileFields($collectedFields);
    }
890304
private function parseArrayToFieldEntities(array $items, $elementType)
    {
        $entities = [];
        foreach ($items as $item) {
            $entities[] = $this->parseArrayToFieldEntity($item, $elementType);
        }

        return $entities;
    }
353833
public function processFieldsChangeType(ContentTypeInterface $contentType, $fieldTypes)
    {
        foreach ($contentType->getFields() as $field) {
            if (!isset($fieldTypes[$field->getId()])) {
                continue;
            }
            if ($fieldTypes[$field->getId()] == $field->getType()) {
                continue;
            }

            $this->om->remove($field);

            $fieldClass = $this->configurationManager->getEntityClass('field');
            $newField = new $fieldClass;
            $newField->setType($field->getType());
            $newField->setContentType($field->getContentType());
            $newField->setName($field->getName());
            $newField->setSlug($field->getSlug());
            $newField->setRequired($field->isRequired());
            $newField->setSortOrder($field->getSortOrder());
            $newField->setOptions($field->getOptions());
            $newField->setHint($field->getHint());
            $this->om->persist($newField);
        }
    }
442179
public static function registerSerializerFactory($factory, string ...$contentTypes) {
    foreach ($contentTypes as $contentType) {
      self::getSerializerFactories()[$contentType] = $factory;
    }
  }
72709
public function get(ContentType $contentType, array $templateFields)
    {
        $select = new ArrayObject();

        $this->build($select, $contentType->getFields());
        $this->build($select, $templateFields, 'templatefields');

        return iterator_to_array($select) ?: null;
    }
728541
protected function addContentTypeFieldsToForm($contentTypeFields, FormInterface $form)
    {
        /** @var FieldTypeInterface $contentTypeField */
        foreach ($contentTypeFields as $contentTypeField) {

            if (isset($this->fieldTypesConfiguration[$contentTypeField->getType()])) {
                $this->addFieldToForm($contentTypeField, $form);
            }
        }
    }
12448
public function readScopeIdentifiers(int $identifier): array
    {
        try {
            $schema = $this->getDatabaseSchema();
            return $this->readBelongsToManyRelationshipIdentifiers(
                $identifier,
                $schema->getTokensScopesTable(),
                $schema->getTokensScopesTokenIdentityColumn(),
                $schema->getTokensScopesScopeIdentityColumn()
            );
        } catch (RepositoryException $exception) {
            $message = 'Reading scopes for a token failed.';
            throw new RepositoryException($message, 0, $exception);
        }
    }
1327953
public function countRecords($contentTypeName = null, DataDimensions $dataDimensions = null)
    {
        if ($contentTypeName == null)
        {
            $contentTypeName = $this->getCurrentContentTypeName();
        }

        if ($dataDimensions == null)
        {
            $dataDimensions = $this->getCurrentDataDimensions();
        }

        if ($this->hasContentType($contentTypeName))
        {

            $info = $this->getRepositoryInfo($dataDimensions);

            return $info['content'][$contentTypeName]['count'];
        }

        throw new AnyContentClientException ('Unknown content type ' . $contentTypeName);

    }
1204699
public function loadContentTypeDraftFieldDefinitionList($contentTypeId)
    {
        $contentTypeDraft = $this->contentTypeService->loadContentTypeDraft($contentTypeId);

        return new Values\FieldDefinitionList(
            $contentTypeDraft,
            $contentTypeDraft->getFieldDefinitions()
        );
    }
605924
protected function getFieldValue($value, FieldDefinition $fieldDefinition, $contentTypeIdentifier, array $context = array())
    {
        $fieldTypeIdentifier = $fieldDefinition->fieldTypeIdentifier;

        if (is_array($value) || $this->fieldHandlerManager->managesField($fieldTypeIdentifier, $contentTypeIdentifier)) {
            // since we now allow refs to be arrays, let's attempt a 1st pass at resolving them here instead of every single fieldHandler...
            if (is_string($value) && $this->fieldHandlerManager->doPreResolveStringReferences($fieldTypeIdentifier, $contentTypeIdentifier)) {
                $value = $this->referenceResolver->resolveReference($value);
            }
            // inject info about the current content type and field into the context
            $context['contentTypeIdentifier'] = $contentTypeIdentifier;
            $context['fieldIdentifier'] = $fieldDefinition->identifier;
            return $this->fieldHandlerManager->hashToFieldValue($fieldTypeIdentifier, $contentTypeIdentifier, $value, $context);
        }

        return $this->getSingleFieldValue($value, $fieldDefinition, $contentTypeIdentifier, $context);
    }
142186
public static function getDefaultLoaders(LoaderInterface $fileLoader = null): array
    {
        $loaders = [
            'dir' => new Loader\DirLoader(),
            'ini' => new Loader\IniLoader(),
            'json' => new Loader\JsonLoader(),
            'yaml' => function_exists('yaml_parse') ? new Loader\YamlLoader() : new Loader\YamlSymfonyLoader(),
            'env' => new Loader\EnvLoader(),
            'Aws\DynamoDb\DynamoDbClient' => new Loader\DynamoDBLoader()
        ];

        $loaders['yml'] = $loaders['yaml'];

        if (isset($fileLoader)) {
            $loaders['dir']->setFileLoader($fileLoader);
        }

        return $loaders;
    }
954930
public function parseFieldValue($contentInfoId, $fieldDefIdentifier, $value)
    {
        $contentInfo = $this->contentService->loadContentInfo($contentInfoId);
        $contentType = $this->contentTypeService->loadContentType($contentInfo->contentTypeId);

        $fieldDefinition = $contentType->getFieldDefinition($fieldDefIdentifier);

        return $this->parseValue($fieldDefinition->fieldTypeIdentifier, $value);
    }
1011059
private function getImageFieldIdentifier($contentId, $language, $related = false)
    {
        $content = $this->contentService->loadContent($contentId);
        $contentType = $this->contentTypeService->loadContentType($content->contentInfo->contentTypeId);

        $fieldDefinitions = $this->getFieldDefinitionList();
        $fieldNames = array_flip($fieldDefinitions);

        if (in_array('ezimage', $fieldDefinitions)) {
            return $fieldNames['ezimage'];
        } elseif (in_array('ezobjectrelation', $fieldDefinitions) && !$related) {
            $field = $content->getFieldValue($fieldNames['ezobjectrelation'], $language);

            if (!empty($field->destinationContentId)) {
                return $this->getImageFieldIdentifier($field->destinationContentId, $language, true);
            }
        } else {
            return $this->getConfiguredFieldIdentifier('image', $contentType);
        }
    }
106395
public function getAllRecords($contentTypeName = null, DataDimensions $dataDimensions = null)
    {
        if ($contentTypeName == null)
        {
            $contentTypeName = $this->getCurrentContentTypeName();
        }

        if ($dataDimensions == null)
        {
            $dataDimensions = $this->getCurrentDataDimensions();
        }

        if ($this->hasContentType($contentTypeName))
        {
            if ($this->hasStashedAllRecords($contentTypeName, $dataDimensions, $this->getRecordClassForContentType($contentTypeName)))
            {
                return $this->getStashedAllRecords($contentTypeName, $dataDimensions, $this->getRecordClassForContentType($contentTypeName));
            }

            $records = $this->requestRecords($contentTypeName, $dataDimensions, '');

            $this->stashAllRecords($records, $dataDimensions);

            return $records;
        }

        throw new AnyContentClientException ('Unknown content type ' . $contentTypeName);
    }
946708
public function getContentTypesByIdentifier($identifier)
    {
        if (strstr($identifier, ',')) {
            $contentTypeArray = explode(',', $identifier);
        } else {
            $contentTypeArray[] = $identifier;
        }

        $contentTypesCollection = array();
        foreach ($contentTypeArray as $contentTypeIdentifier) {
            if (!empty($contentTypeIdentifier)) {
                $contentTypesCollection[] = $this->contentTypeService->loadContentTypeByIdentifier($contentTypeIdentifier);
            }
        }

        return $contentTypesCollection;
    }
992660
private function getFieldTypeIdentifier(Content $content, Field $field)
    {
        $contentType = $content->getContentType();
        $key = $contentType->id . '  ' . $field->fieldDefIdentifier;

        if (!isset($this->fieldTypeIdentifiers[$key])) {
            $this->fieldTypeIdentifiers[$key] = $contentType
                ->getFieldDefinition($field->fieldDefIdentifier)
                ->fieldTypeIdentifier;
        }

        return $this->fieldTypeIdentifiers[$key];
    }
1089954
public static function bySerializedContentType($contentType)
    {
        switch($contentType)
        {
            case PhpSerializer::SERIALIZED_CONTENT_TYPE:
                $serializer = new PhpSerializer();
                break;
            case JsonSerializer::SERIALIZED_CONTENT_TYPE:
                $serializer = new JsonSerializer();
                break;
            case NullSerializer::SERIALIZED_CONTENT_TYPE:
                $serializer = new NullSerializer();
                break;
            default:
                throw new Exception('Not supported content type!');
        }
        return $serializer;
    }