Processes the class metadata.

@param ClassMetadata $metadata
@param string        $property
@param string        $prefix
502124
public function processClassMetadata(ClassMetadata $metadata, $property, $prefix)
    {
        if (in_array($metadata->getName(), $this->processedClasses)) {
            return;
        }

        $metadata->mapEmbedded([
            'fieldName'    => $property,
            'class'        => $this->embeddableMetadata->getName(),
            'columnPrefix' => empty($prefix) ? false : $prefix,
        ]);

        $metadata->inlineEmbeddable($property, $this->embeddableMetadata);

        $this->processedClasses[] = $metadata->getName();
    }
1136124
public function loadMetadataForClass($className, ClassMetadata $metadata)
    {
        $this->mappers->getMapperFor($className)->map(
            $this->getFluent($metadata)
        );
    }
127859
protected function doLoadMetadata(
        string $className,
        ?ClassMetadata $parent,
        ClassMetadataBuildingContext $metadataBuildingContext
    ) : ClassMetadata {
        $classMetadata = new ClassMetadata($className, $metadataBuildingContext);

        if ($parent) {
            $classMetadata->setParent($parent);

            foreach ($parent->getDeclaredPropertiesIterator() as $fieldName => $property) {
                $classMetadata->addInheritedProperty($property);
            }

            $classMetadata->setInheritanceType($parent->inheritanceType);
            $classMetadata->setIdentifier($parent->identifier);

            if ($parent->discriminatorColumn) {
                $classMetadata->setDiscriminatorColumn($parent->discriminatorColumn);
                $classMetadata->setDiscriminatorMap($parent->discriminatorMap);
            }

            $classMetadata->setLifecycleCallbacks($parent->lifecycleCallbacks);
            $classMetadata->setChangeTrackingPolicy($parent->changeTrackingPolicy);

            if ($parent->isMappedSuperclass) {
                $classMetadata->setCustomRepositoryClassName($parent->getCustomRepositoryClassName());
            }
        }

        // Invoke driver
        try {
            $this->driver->loadMetadataForClass($classMetadata->getClassName(), $classMetadata, $metadataBuildingContext);
        } catch (ReflectionException $e) {
            throw MappingException::reflectionFailure($classMetadata->getClassName(), $e);
        }

        $this->completeIdentifierGeneratorMappings($classMetadata);

        if ($parent) {
            if ($parent->getCache()) {
                $classMetadata->setCache(clone $parent->getCache());
            }

            if (! empty($parent->entityListeners) && empty($classMetadata->entityListeners)) {
                $classMetadata->entityListeners = $parent->entityListeners;
            }
        }

        $this->completeRuntimeMetadata($classMetadata, $parent);

        if ($this->evm->hasListeners(Events::loadClassMetadata)) {
            $eventArgs = new LoadClassMetadataEventArgs($classMetadata, $this->em);

            $this->evm->dispatchEvent(Events::loadClassMetadata, $eventArgs);
        }

        $this->buildValueGenerationPlan($classMetadata);
        $this->validateRuntimeMetadata($classMetadata, $parent);

        return $classMetadata;
    }
384646
protected function validate(PropertyMetadata $metadata, string $name, & $value)
	{
		if (!$metadata->isValid($value)) {
			$class = get_class($this);
			throw new InvalidArgumentException("Value for {$class}::\${$name} property is invalid.");
		}
	}
491919
protected function addMetaData($event, array $metaData)
    {
        if (is_array($metaData) && count($metaData)) {
            foreach ($metaData as $key => $metaDatum) {
                $method = 'set' . ucfirst($key);

                if (method_exists($event, $method)) {
                    $event->$method($metaDatum);
                }
            }
        }
    }
494099
private function processProperty($property, array $options)
    {
        if (null === $property) {
            return null;
        }

        if ($property instanceof MetadataInterface) {
            $this->process($property, $options);

            return $property;
        }

        if (is_array($property)) {
            foreach ($property as $key => &$value) {
                $value = $this->processProperty($value, $options);
            }

            return $property;
        }

        return $this->twig->createTemplate((string) $property)->render($options);
    }
630833
private function normalizeValue(ClassMetadata $metadata, $property, $value)
    {
        if (self::PARAMETER_ID_KEY === $property) {
            return $this->getFilterValueFromUrl($value);
        }

        if (self::PARAMETER_NULL_VALUE === $value) {
            return null;
        }

        switch ($metadata->getTypeOfField($property)) {
            case 'boolean':
                return (bool) $value;

            case 'integer':
                return (int) $value;

            case 'float':
                return (float) $value;

            case 'datetime':
                // the input has the format `2015-04-28T02:23:50 00:00`, transform it to match the database format
                // `2015-04-28 02:23:50`
                return preg_replace('/(\d{4}(-\d{2}){2})T(\d{2}(:\d{2}){2}) \d{2}:\d{2}/', '$1 $3', $value);
        }

        return $value;
    }
525671
private function convertCacheAnnotationToCacheMetadata(
        Annotation\Cache $cacheAnnot,
        Mapping\ClassMetadata $metadata,
        $fieldName = null
    ) {
        $usage         = constant(sprintf('%s::%s', Mapping\CacheUsage::class, $cacheAnnot->usage));
        $baseRegion    = strtolower(str_replace('\\', '_', $metadata->getRootClassName()));
        $defaultRegion = $baseRegion . ($fieldName ? '__' . $fieldName : '');

        return new Mapping\CacheMetadata($usage, $cacheAnnot->region ?: $defaultRegion);
    }
652310
public static function loadValidatorMetadata(ClassMetadata $metadata)
    {
        $metadata->addPropertyConstraint('contractNumber', new Assert\NotBlank());
        $metadata->addPropertyConstraint('contractNumber', new Assert\Type(array('type' => 'integer')));
        $metadata->addPropertyConstraint('contractNumber', new Assert\Regex(array('pattern' => '/^[0-9]{6}$/')));

        $metadata->addPropertyConstraint('password', new Assert\NotBlank());
        $metadata->addPropertyConstraint('password', new Assert\Type(array('type' => 'string')));

        $metadata->addPropertyConstraint('service', new Assert\NotBlank());
        $metadata->addPropertyConstraint('service', new Assert\Valid());

        $metadata->addPropertyConstraint('parcel', new Assert\NotBlank());
        $metadata->addPropertyConstraint('parcel', new Assert\Valid());

        $metadata->addPropertyConstraint('dest', new Assert\NotBlank());
        $metadata->addPropertyConstraint('dest', new Assert\Valid());

        $metadata->addPropertyConstraint('exp', new Assert\NotBlank());
        $metadata->addPropertyConstraint('exp', new Assert\Valid());
    }
1053680
public function loadClassMetadata(Mapping\ClassMetadataInterface $metadata)
    {
        
        $reflClass = $metadata->getReflectionClass();
        
        //Iterate over properties to get annotations
        foreach($reflClass->getProperties() as $property) {
            
            $this->readProperty($property, $metadata);
            
        }
        
    }
1243109
public function preUpdate(ClassMetadata $class, object $document) : void
    {
        if (! empty($class->lifecycleCallbacks[Events::preUpdate])) {
            $class->invokeLifecycleCallbacks(Events::preUpdate, $document, [new PreUpdateEventArgs($document, $this->dm, $this->uow->getDocumentChangeSet($document))]);
            $this->uow->recomputeSingleDocumentChangeSet($class, $document);
        }
        $this->evm->dispatchEvent(Events::preUpdate, new PreUpdateEventArgs($document, $this->dm, $this->uow->getDocumentChangeSet($document)));
        $this->cascadePreUpdate($class, $document);
    }
762329
public function process(\ReflectionClass $reflection, Definition $definition)
    {
        foreach ($reflection->getProperties() as $property)
        {
            $this->processProperty($property, $definition);
        }
    }
558801
public function createPropertyForm(Metadata $meta, $property, $entity)
    {
        $dataClass = $meta->getEntityClass();

        if (!empty($entity) && !$this->propertyAccessor->isWritable($entity, $property) && null !== $meta->getTranslationClass()) {
            /** @var \Knp\DoctrineBehaviors\Model\Translatable\Translatable $entity */
            $translations = $entity->getTranslations();

            /** @var \Knp\DoctrineBehaviors\Model\Translatable\Translation $translation */
            foreach ($translations as $translation) {
                if ($translation->getLocale() === $entity->getCurrentLocale()) {
                    $dataClass = $meta->getTranslationClass();
                    $entity = $translation;
                }
            }
        }

        return $this->genericFormFactory->createNamed($meta->getFormTypeName().'_property', BaseType::class, $entity, [
            'action_type'       => 'index',
            'data_class'        => $dataClass,
            'field_filter'      => $property,
            'metadata'          => $meta,
            'required'          => false,
            'validation_groups' => [
                'Default',
                'AdminUpdateProperty',
            ],
        ]);
    }
408765
public function loadMetadataForClass($className, CommonClassMetadata $metadata)
    {
        /** @var \Doctrine\KeyValueStore\Mapping\ClassMetadata $metadata */
        try {
            $element = $this->getElement($className);
        } catch (MappingException $exception) {
            throw new \InvalidArgumentException($metadata->name . ' is not a valid key-value-store entity.');
        }

        $class = new \ReflectionClass($className);

        if (isset($element['storageName'])) {
            $metadata->storageName = $element['storageName'];
        }

        $ids = [];
        if (isset($element['id'])) {
            $ids = $element['id'];
        }

        $transients = [];
        if (isset($element['transient'])) {
            $transients = $element['transient'];
        }

        foreach ($class->getProperties() as $property) {
            if (in_array($property->getName(), $ids)) {
                $metadata->mapIdentifier($property->getName());

                continue;
            }

            if (in_array($property->getName(), $transients)) {
                $metadata->skipTransientField($property->getName());

                continue;
            }

            $metadata->mapField([
                'fieldName' => $property->getName(),
            ]);
        }
    }
240607
private function instantiateFromMetadata(Metadata $metadata)
    {
        $class = $metadata->getClass();

        if (!class_exists($class)) {
            throw new \RuntimeException(sprintf(
                'Document class "%s" does not exist', $class
            ));
        }

        $document = new $class();

        return $document;
    }
323294
protected function processShortcuts(array $property, ClassDefinition $classDefinition)
    {
        foreach ($property['shortcuts'] as $shortcut) {
            if ('_' == substr($property['name'], 0, 1)) {
                $name = substr($property['name'], 1);
            } else {
                $name = $property['name'];
            }

            $docBlock = null;
            if (isset($shortcut['docblock'])) {
                $docBlock = $shortcut['docblock'];
            } elseif (isset($property['docblock'])) {
                $docBlock = $property['docblock'];
            }

            $returnsType = [];

            if ($docBlock) {
                $docBlockParser = new DocblockParser('/'.$docBlock.'/');
                $docBlockParsed = $docBlockParser->parse();

                if ($annotations = $docBlockParsed->getAnnotationsByType('var')) {
                    $returnsType = array_map(function ($type) {
                        return 'mixed' == ($type = trim($type)) ? 'variable' : $type;
                    }, (array) explode('|', $annotations[0]->getString()));
                }

                // Clear annotations
                $docBlockParsed->setAnnotations([]);
                $docBlock = $docBlockParsed->generate();
            }

            switch ($shortcut['name']) {
                case 'get':
                    $classDefinition->addMethod(new ClassMethod(
                        $classDefinition,
                        ['public'],
                        'get'.camelize($name),
                        null,
                        new StatementsBlock([
                            [
                                'type' => 'return',
                                'expr' => [
                                    'type' => 'property-access',
                                    'left' => [
                                        'type' => 'variable',
                                        'value' => 'this',
                                    ],
                                    'right' => [
                                        'type' => 'variable',
                                        'value' => $property['name'],
                                    ],
                                ],
                            ],
                        ]),
                        $docBlock,
                        $this->createReturnsType($returnsType, true),
                        $shortcut
                    ), $shortcut);
                    break;

                case 'set':
                    $classDefinition->addMethod(new ClassMethod(
                        $classDefinition,
                        ['public'],
                        'set'.camelize($name),
                        new ClassMethodParameters([
                            [
                                'type' => 'parameter',
                                'name' => $name,
                                'const' => 0,
                                'data-type' => 1 == \count($returnsType) ? $returnsType[0] : 'variable',
                                'mandatory' => 0,
                            ],
                        ]),
                        new StatementsBlock([
                            [
                                'type' => 'let',
                                'assignments' => [
                                    [
                                        'assign-type' => 'object-property',
                                        'operator' => 'assign',
                                        'variable' => 'this',
                                        'property' => $property['name'],
                                        'expr' => [
                                            'type' => 'variable',
                                            'value' => $name,
                                            'file' => $property['file'],
                                            'line' => $property['line'],
                                            'char' => $property['char'],
                                        ],
                                        'file' => $property['file'],
                                        'line' => $property['line'],
                                        'char' => $property['char'],
                                    ],
                                ],
                            ],
                            [
                                'type' => 'return',
                                'expr' => [
                                    'type' => 'variable',
                                    'value' => 'this',
                                    'file' => $property['file'],
                                    'line' => $property['line'],
                                    'char' => $property['char'],
                                ],
                            ],
                        ]),
                        $docBlock,
                        null,
                        $shortcut
                    ), $shortcut);
                    break;

                case 'toString':
                case '__toString':
                    $classDefinition->addMethod(new ClassMethod(
                        $classDefinition,
                        ['public'],
                        '__toString',
                        null,
                        new StatementsBlock([
                            [
                                'type' => 'return',
                                'expr' => [
                                    'type' => 'property-access',
                                    'left' => [
                                        'type' => 'variable',
                                        'value' => 'this',
                                    ],
                                    'right' => [
                                        'type' => 'variable',
                                        'value' => $property['name'],
                                    ],
                                ],
                            ],
                        ]),
                        $docBlock,
                        $this->createReturnsType(['string']),
                        $shortcut
                    ), $shortcut);
                    break;

                default:
                    throw new CompilerException("Unknown shortcut '".$shortcut['name']."'", $shortcut);
            }
        }
    }
5666
public function postRemove(ClassMetadata $class, object $document) : void
    {
        $class->invokeLifecycleCallbacks(Events::postRemove, $document, [new LifecycleEventArgs($document, $this->dm)]);
        $this->evm->dispatchEvent(Events::postRemove, new LifecycleEventArgs($document, $this->dm));
    }