@param Annotation\Annotation[] $propertyAnnotations

@throws Mapping\MappingException
507414
private function convertReflectionPropertyToFieldMetadata(
        ReflectionProperty $reflProperty,
        array $propertyAnnotations,
        Mapping\ClassMetadata $metadata
    ) : Mapping\FieldMetadata {
        $className   = $metadata->getClassName();
        $fieldName   = $reflProperty->getName();
        $isVersioned = isset($propertyAnnotations[Annotation\Version::class]);
        $columnAnnot = $propertyAnnotations[Annotation\Column::class];

        if ($columnAnnot->type === null) {
            throw Mapping\MappingException::propertyTypeIsRequired($className, $fieldName);
        }

        $fieldMetadata = $this->convertColumnAnnotationToFieldMetadata($columnAnnot, $fieldName, $isVersioned);

        // Check for Id
        if (isset($propertyAnnotations[Annotation\Id::class])) {
            $fieldMetadata->setPrimaryKey(true);
        }

        // Check for GeneratedValue strategy
        if (isset($propertyAnnotations[Annotation\GeneratedValue::class])) {
            $generatedValueAnnot = $propertyAnnotations[Annotation\GeneratedValue::class];
            $strategy            = strtoupper($generatedValueAnnot->strategy);
            $idGeneratorType     = constant(sprintf('%s::%s', Mapping\GeneratorType::class, $strategy));

            if ($idGeneratorType !== Mapping\GeneratorType::NONE) {
                $idGeneratorDefinition = [];

                // Check for CustomGenerator/SequenceGenerator/TableGenerator definition
                switch (true) {
                    case isset($propertyAnnotations[Annotation\SequenceGenerator::class]):
                        $seqGeneratorAnnot = $propertyAnnotations[Annotation\SequenceGenerator::class];

                        $idGeneratorDefinition = [
                            'sequenceName' => $seqGeneratorAnnot->sequenceName,
                            'allocationSize' => $seqGeneratorAnnot->allocationSize,
                        ];

                        break;

                    case isset($propertyAnnotations[Annotation\CustomIdGenerator::class]):
                        $customGeneratorAnnot = $propertyAnnotations[Annotation\CustomIdGenerator::class];

                        $idGeneratorDefinition = [
                            'class' => $customGeneratorAnnot->class,
                            'arguments' => $customGeneratorAnnot->arguments,
                        ];

                        break;

                    /** @todo If it is not supported, why does this exist? */
                    case isset($propertyAnnotations['Doctrine\ORM\Mapping\TableGenerator']):
                        throw Mapping\MappingException::tableIdGeneratorNotImplemented($className);
                }

                $fieldMetadata->setValueGenerator(new Mapping\ValueGeneratorMetadata($idGeneratorType, $idGeneratorDefinition));
            }
        }

        return $fieldMetadata;
    }
805278
public void setMapperProperties(Properties properties) {
        if (this.mapperHelper == null) {
            this.mapperHelper = new MapperHelper();
        }
        this.mapperHelper.setProperties(properties);
    }
807119
private function formatMappings(array $propertyMappings)
    {
        $output = array();

        foreach ($propertyMappings as $propertyName => $mapping) {
            $output[] = $this->formatField(sprintf('  %s', $propertyName), '');

            foreach ($mapping as $field => $value) {
                $output[] = $this->formatField(sprintf('    %s', $field), $this->formatValue($value));
            }
        }

        return $output;
    }
841168
public function setPropertiesValues($propertiesValues)
    {
        $returnValue = (bool) false;
        $returnValue = $this->getImplementation()->setPropertiesValues($this, $propertiesValues);
        $this->onUpdate();
        return (bool) $returnValue;
    }
584677
protected function parseConfig(AnnotationBag $propertyAnnotations) {
		$this->attribute = $propertyAnnotations->has('Attr') ? $propertyAnnotations->get('Attr') : null;
		$this->lazy = $propertyAnnotations->has('Lazy');
		$this->cascade = $propertyAnnotations->has('Cascade');
		$this->join = $propertyAnnotations->has('Join') ? $propertyAnnotations->get('Join') : null;
		
		//parse options
		$this->index = $propertyAnnotations->has('Index') ? $propertyAnnotations->get('Index')->getValue() : null;
		$order = $propertyAnnotations->find('OrderBy', Filter::HAS_ARGUMENT);
		
		if (!empty($order)) {
			$this->order = [];
				
			foreach ($order as $option)
				$this->order[] = $option->getValue();
		}
		
		$this->cache = $propertyAnnotations->has('Cache') ? $propertyAnnotations->get('Cache') : null;
	}
169258
private function initializeObjectDataProperties(PropertiesInterface $properties)
    {
        // get secondary types
        $propertyList = $properties->getProperties();
        if (isset($propertyList[PropertyIds::SECONDARY_OBJECT_TYPE_IDS])) {
            $this->secondaryTypes = [];
            foreach ($propertyList[PropertyIds::SECONDARY_OBJECT_TYPE_IDS]->getValues() as $secondaryTypeId) {
                $type = $this->getSession()->getTypeDefinition($secondaryTypeId);
                if ($type instanceof SecondaryTypeInterface) {
                    $this->secondaryTypes[] = $type;
                }
            }
        }

        $this->properties = $this->getObjectFactory()->convertPropertiesDataToPropertyList(
            $this->getObjectType(),
            (array) $this->getSecondaryTypes(),
            $properties
        );

        $this->extensions[(string) ExtensionLevel::cast(
            ExtensionLevel::PROPERTIES
        )] = $properties->getExtensions();
    }
1346955
private function convertReflectionPropertyToOneToManyAssociationMetadata(
        ReflectionProperty $reflectionProperty,
        array $propertyAnnotations,
        Mapping\ClassMetadata $classMetadata
    ) {
        $className      = $classMetadata->getClassName();
        $fieldName      = $reflectionProperty->getName();
        $oneToManyAnnot = $propertyAnnotations[Annotation\OneToMany::class];

        if ($oneToManyAnnot->targetEntity === null) {
            throw Mapping\MappingException::missingTargetEntity($fieldName);
        }

        $assocMetadata = new Mapping\OneToManyAssociationMetadata($fieldName);
        $targetEntity  = $oneToManyAnnot->targetEntity;

        $assocMetadata->setSourceEntity($className);
        $assocMetadata->setTargetEntity($targetEntity);
        $assocMetadata->setCascade($this->getCascade($className, $fieldName, $oneToManyAnnot->cascade));
        $assocMetadata->setOrphanRemoval($oneToManyAnnot->orphanRemoval);
        $assocMetadata->setFetchMode($this->getFetchMode($className, $oneToManyAnnot->fetch));

        if (! empty($oneToManyAnnot->mappedBy)) {
            $assocMetadata->setMappedBy($oneToManyAnnot->mappedBy);
        }

        if (! empty($oneToManyAnnot->indexBy)) {
            $assocMetadata->setIndexedBy($oneToManyAnnot->indexBy);
        }

        // Check for OrderBy
        if (isset($propertyAnnotations[Annotation\OrderBy::class])) {
            $orderByAnnot = $propertyAnnotations[Annotation\OrderBy::class];

            $assocMetadata->setOrderBy($orderByAnnot->value);
        }

        // Check for Id
        if (isset($propertyAnnotations[Annotation\Id::class])) {
            $assocMetadata->setPrimaryKey(true);
        }

        // Check for Cache
        if (isset($propertyAnnotations[Annotation\Cache::class])) {
            $cacheAnnot    = $propertyAnnotations[Annotation\Cache::class];
            $cacheMetadata = $this->convertCacheAnnotationToCacheMetadata($cacheAnnot, $classMetadata, $fieldName);

            $assocMetadata->setCache($cacheMetadata);
        }

        return $assocMetadata;
    }
74890
private function convertReflectionPropertyToManyToOneAssociationMetadata(
        ReflectionProperty $reflectionProperty,
        array $propertyAnnotations,
        Mapping\ClassMetadata $classMetadata
    ) {
        $className      = $classMetadata->getClassName();
        $fieldName      = $reflectionProperty->getName();
        $manyToOneAnnot = $propertyAnnotations[Annotation\ManyToOne::class];

        if ($manyToOneAnnot->targetEntity === null) {
            throw Mapping\MappingException::missingTargetEntity($fieldName);
        }

        $assocMetadata = new Mapping\ManyToOneAssociationMetadata($fieldName);
        $targetEntity  = $manyToOneAnnot->targetEntity;

        $assocMetadata->setSourceEntity($className);
        $assocMetadata->setTargetEntity($targetEntity);
        $assocMetadata->setCascade($this->getCascade($className, $fieldName, $manyToOneAnnot->cascade));
        $assocMetadata->setFetchMode($this->getFetchMode($className, $manyToOneAnnot->fetch));

        if (! empty($manyToOneAnnot->inversedBy)) {
            $assocMetadata->setInversedBy($manyToOneAnnot->inversedBy);
        }

        // Check for Id
        if (isset($propertyAnnotations[Annotation\Id::class])) {
            $assocMetadata->setPrimaryKey(true);
        }

        // Check for Cache
        if (isset($propertyAnnotations[Annotation\Cache::class])) {
            $cacheAnnot    = $propertyAnnotations[Annotation\Cache::class];
            $cacheMetadata = $this->convertCacheAnnotationToCacheMetadata($cacheAnnot, $classMetadata, $fieldName);

            $assocMetadata->setCache($cacheMetadata);
        }

        // Check for JoinColumn/JoinColumns annotations
        switch (true) {
            case isset($propertyAnnotations[Annotation\JoinColumn::class]):
                $joinColumnAnnot = $propertyAnnotations[Annotation\JoinColumn::class];
                $joinColumn      = $this->convertJoinColumnAnnotationToJoinColumnMetadata(
                    $reflectionProperty,
                    $joinColumnAnnot,
                    $classMetadata
                );

                $assocMetadata->addJoinColumn($joinColumn);

                break;

            case isset($propertyAnnotations[Annotation\JoinColumns::class]):
                $joinColumnsAnnot = $propertyAnnotations[Annotation\JoinColumns::class];

                foreach ($joinColumnsAnnot->value as $joinColumnAnnot) {
                    $joinColumn = $this->convertJoinColumnAnnotationToJoinColumnMetadata(
                        $reflectionProperty,
                        $joinColumnAnnot,
                        $classMetadata
                    );

                    $assocMetadata->addJoinColumn($joinColumn);
                }

                break;
        }

        return $assocMetadata;
    }
1340989
protected function setAdditionalColumnProperties($name, Annotation &$annotation, array $propertyAnnotations, $embedded=false, $columnPrefix=false)
    {
        // scan for primary and versioned property
        foreach ($propertyAnnotations as $subAnnotation) {
            // set primary key
            if ($subAnnotation instanceof \ProAI\Datamapper\Annotations\Id) {
                $annotation->primary = true;
            }
            // set auto increment
            if ($subAnnotation instanceof \ProAI\Datamapper\Annotations\AutoIncrement) {
                $annotation->autoIncrement = true;
            }
            // set auto increment
            if ($subAnnotation instanceof \ProAI\Datamapper\Annotations\AutoUuid) {
                $annotation->autoUuid = true;
            }
            // set versioned
            if ($subAnnotation instanceof \ProAI\Datamapper\Annotations\Versioned) {
                $annotation->versioned = true;
            }
        }

        // set column name
        $annotation->name = $this->getColumnName($annotation->name ?: $name, $columnPrefix);
    }
710112
public static function parse($model, $propertyName, $annotation)
    {
        if(!$model->$propertyName)
        {
            return;
        }
        $className = BeanFactory::getObjectClass($model);
        $autoInsert = AnnotationManager::getPropertyAnnotations($className, $propertyName, AutoInsert::class)[0] ?? null;
        $autoSave = AnnotationManager::getPropertyAnnotations($className, $propertyName, AutoSave::class)[0] ?? null;

        if($autoInsert)
        {
            if(!$autoInsert->status)
            {
                return;
            }
        }
        else if(!$autoSave || !$autoSave->status)
        {
            return;
        }

        if($annotation instanceof \Imi\Model\Annotation\Relation\OneToOne)
        {
            static::parseByOneToOne($model, $propertyName, $annotation);
        }
        else if($annotation instanceof \Imi\Model\Annotation\Relation\OneToMany)
        {
            static::parseByOneToMany($model, $propertyName, $annotation);
        }
        else if($annotation instanceof \Imi\Model\Annotation\Relation\ManyToMany)
        {
            static::parseByManyToMany($model, $propertyName, $annotation);
        }
        else if($annotation instanceof \Imi\Model\Annotation\Relation\PolymorphicOneToOne)
        {
            static::parseByPolymorphicOneToOne($model, $propertyName, $annotation);
        }
        else if($annotation instanceof \Imi\Model\Annotation\Relation\PolymorphicOneToMany)
        {
            static::parseByPolymorphicOneToMany($model, $propertyName, $annotation);
        }
        else if($annotation instanceof \Imi\Model\Annotation\Relation\PolymorphicManyToMany)
        {
            static::parseByPolymorphicManyToMany($model, $propertyName, $annotation);
        }
    }
301181
protected function addProperty($nodeType, $propertyName, array $propertyConfiguration)
    {
        if (isset($this->properties[$propertyName])) {
            $this->properties[$propertyName]->domains[] = $nodeType;
        } else {
            $propertyLabel = isset($propertyConfiguration['ui']['label']) ? $propertyConfiguration['ui']['label'] : $propertyName;
            $this->properties[$propertyName] = (object) [
                'comment' => $propertyLabel,
                'comment_plain' => $propertyLabel,
                'domains' => [$nodeType],
                'id' => $propertyName,
                'label' => $propertyName,
                'ranges' => [],
                'min' => 0,
                'max' => -1
            ];
        }
    }
537255
private function convertReflectionPropertyToManyToManyAssociationMetadata(
        ReflectionProperty $reflectionProperty,
        array $propertyAnnotations,
        Mapping\ClassMetadata $metadata,
        Mapping\ClassMetadataBuildingContext $metadataBuildingContext
    ) : Mapping\ManyToManyAssociationMetadata {
        $className       = $metadata->getClassName();
        $fieldName       = $reflectionProperty->getName();
        $manyToManyAnnot = $propertyAnnotations[Annotation\ManyToMany::class];
        $assocMetadata   = new Mapping\ManyToManyAssociationMetadata($fieldName);
        $targetEntity    = $manyToManyAnnot->targetEntity;

        $assocMetadata->setTargetEntity($targetEntity);
        $assocMetadata->setCascade($this->getCascade($className, $fieldName, $manyToManyAnnot->cascade));
        $assocMetadata->setOrphanRemoval($manyToManyAnnot->orphanRemoval);
        $assocMetadata->setFetchMode($this->getFetchMode($className, $manyToManyAnnot->fetch));

        if (! empty($manyToManyAnnot->mappedBy)) {
            $assocMetadata->setMappedBy($manyToManyAnnot->mappedBy);
        }

        if (! empty($manyToManyAnnot->inversedBy)) {
            $assocMetadata->setInversedBy($manyToManyAnnot->inversedBy);
        }

        if (! empty($manyToManyAnnot->indexBy)) {
            $assocMetadata->setIndexedBy($manyToManyAnnot->indexBy);
        }

        // Check for JoinTable
        if (isset($propertyAnnotations[Annotation\JoinTable::class])) {
            $joinTableAnnot    = $propertyAnnotations[Annotation\JoinTable::class];
            $joinTableMetadata = $this->convertJoinTableAnnotationToJoinTableMetadata($joinTableAnnot);

            $assocMetadata->setJoinTable($joinTableMetadata);
        }

        // Check for OrderBy
        if (isset($propertyAnnotations[Annotation\OrderBy::class])) {
            $orderByAnnot = $propertyAnnotations[Annotation\OrderBy::class];

            $assocMetadata->setOrderBy($orderByAnnot->value);
        }

        // Check for Id
        if (isset($propertyAnnotations[Annotation\Id::class])) {
            throw Mapping\MappingException::illegalToManyIdentifierAssociation($className, $fieldName);
        }

        $this->attachAssociationPropertyCache($propertyAnnotations, $reflectionProperty, $assocMetadata, $metadata);

        return $assocMetadata;
    }
546144
private function loadAnnotations(array $annotations)
    {
        $definition = [];

        foreach ($annotations as $annotation) {
            if ($annotation instanceof Alias) {
                $definition['alias'] = $annotation->alias;
            } elseif ($annotation instanceof Type) {
                $definition['type'] = $annotation->type;
            } elseif ($annotation instanceof Expose) {
                $definition['expose'] = true;
            } elseif ($annotation instanceof Exclude) {
                $definition['exclude'] = true;
            } elseif ($annotation instanceof Readable) {
                $definition['readable'] = $annotation->readable;
            } elseif ($annotation instanceof Writable) {
                $definition['writable'] = $annotation->writable;
            } elseif ($annotation instanceof Accessor) {
                $definition['accessor'] = $annotation->accessor;
            } elseif ($annotation instanceof Mutator) {
                $definition['mutator'] = $annotation->mutator;
            } elseif ($annotation instanceof Since) {
                $definition['since'] = $annotation->version;
            } elseif ($annotation instanceof Until) {
                $definition['until'] = $annotation->version;
            } elseif ($annotation instanceof MaxDepth) {
                $definition['max_depth'] = $annotation->maxDepth;
            } elseif ($annotation instanceof Groups) {
                $definition['groups'] = $annotation->groups;
            } elseif ($annotation instanceof XmlAttribute) {
                $definition['xml_attribute'] = true;
            } elseif ($annotation instanceof XmlValue) {
                $definition['xml_value'] = true;
            } elseif ($annotation instanceof XmlCollection) {
                if ($annotation->entry !== null) {
                    $definition['xml_entry'] = $annotation->entry;
                }

                if ($annotation->entryAttribute !== null) {
                    $definition['xml_entry_attribute'] = $annotation->entryAttribute;
                }

                if ($annotation->keyAsAttribute !== null) {
                    $definition['xml_key_as_attribute'] = $annotation->keyAsAttribute;
                }

                if ($annotation->keyAsNode !== null) {
                    $definition['xml_key_as_node'] = $annotation->keyAsNode;
                }

                if ($annotation->inline !== null) {
                    $definition['xml_inline'] = $annotation->inline;
                }
            }
        }

        return $definition;
    }
664278
public function initAnnotation(array $properties) {
		if (isset ( $properties [0] )) {
			$this->type = $properties [0];
			unset ( $properties [0] );
			if (isset ( $properties [1] )) {
				if (! is_array ( $properties [1] )) {
					$this->constraints = [ "ref" => $properties [1] ];
				} else {
					$this->constraints = $properties [1];
				}
				unset ( $properties [1] );
			}
		} else {
			throw new \Exception ( 'Validator annotation must have a type' );
		}
		parent::initAnnotation ( $properties );
		if (! isset ( ValidatorsManager::$validatorTypes [$this->type] )) {
			throw new \Exception ( 'This type of annotation does not exists : ' . $this->type );
		}
	}
665736
public static function setResponseDataRelationshipSelfLinks($propertyName, array &$mappings, array &$parent)
    {
        $data = [];
        $parentType = $parent[Serializer::CLASS_IDENTIFIER_KEY];

        if (\is_scalar($parentType) && !empty($mappings[$parentType])) {
            $copy = $parent;
            RecursiveFormatterHelper::formatScalarValues($copy);
            if (!empty($copy[Serializer::CLASS_IDENTIFIER_KEY])) {
                unset($copy[Serializer::CLASS_IDENTIFIER_KEY]);
            }

            $idProperties = array_keys($copy);
            foreach ($idProperties as &$property) {
                $property = sprintf('{%s}', $property);
            }
            $idValues = array_values($copy);

            if (!empty($mappings[$parentType]) && !empty($selfLink = $mappings[$parentType]->getRelationshipSelfUrl($propertyName))) {
                $url = self::buildUrl($mappings, $idProperties, $idValues, $selfLink, $parentType);

                if ($url !== $selfLink) {
                    $data[JsonApiTransformer::SELF_LINK][JsonApiTransformer::LINKS_HREF] = $url;
                }
            }
        }

        return $data;
    }
802085
public function addProperty(Property $property)
    {
        $fieldName = $property->getName();

        // Check for empty field name
        if (empty($fieldName)) {
            throw MappingException::missingFieldName($this->className);
        }

        $property->setDeclaringClass($this);

        switch (true) {
            case $property instanceof VersionFieldMetadata:
                $this->validateAndCompleteFieldMapping($property);
                $this->validateAndCompleteVersionFieldMapping($property);
                break;

            case $property instanceof FieldMetadata:
                $this->validateAndCompleteFieldMapping($property);
                break;

            case $property instanceof OneToOneAssociationMetadata:
                $this->validateAndCompleteAssociationMapping($property);
                $this->validateAndCompleteToOneAssociationMetadata($property);
                $this->validateAndCompleteOneToOneMapping($property);
                break;

            case $property instanceof OneToManyAssociationMetadata:
                $this->validateAndCompleteAssociationMapping($property);
                $this->validateAndCompleteToManyAssociationMetadata($property);
                $this->validateAndCompleteOneToManyMapping($property);
                break;

            case $property instanceof ManyToOneAssociationMetadata:
                $this->validateAndCompleteAssociationMapping($property);
                $this->validateAndCompleteToOneAssociationMetadata($property);
                $this->validateAndCompleteManyToOneMapping($property);
                break;

            case $property instanceof ManyToManyAssociationMetadata:
                $this->validateAndCompleteAssociationMapping($property);
                $this->validateAndCompleteToManyAssociationMetadata($property);
                $this->validateAndCompleteManyToManyMapping($property);
                break;

            default:
                // Transient properties are ignored on purpose here! =)
                break;
        }

        $this->addDeclaredProperty($property);
    }
581270
protected function addPropertyTags(PropertyInterface $property)
    {
        foreach ($property->getTags() as $tag) {
            if (!array_key_exists($tag->getName(), $this->tags)) {
                $this->tags[$tag->getName()] = [
                    'tag' => $tag,
                    'properties' => [$tag->getPriority() => $property],
                    'highest' => $property,
                    'lowest' => $property,
                ];
            } else {
                $this->tags[$tag->getName()]['properties'][$tag->getPriority()] = $property;

                // replace highest priority property
                $highestProperty = $this->tags[$tag->getName()]['highest'];
                if ($highestProperty->getTag($tag->getName())->getPriority() < $tag->getPriority()) {
                    $this->tags[$tag->getName()]['highest'] = $property;
                }

                // replace lowest priority property
                $lowestProperty = $this->tags[$tag->getName()]['lowest'];
                if ($lowestProperty->getTag($tag->getName())->getPriority() > $tag->getPriority()) {
                    $this->tags[$tag->getName()]['lowest'] = $property;
                }
            }
        }
    }