Load a metadata file.

@param  string $metadataIdent A metadata file path or namespace.
@return MetadataInterface
7282
protected function loadMetadata($metadataIdent)
    {
        $metadata = $this->metadataLoader()->load($metadataIdent, $this->metadataClass());
        return $metadata;
    }
509339
public function loadMetadataForClass($className, ClassMetadata $metadata)
    {
        $metadataFactory = $this->getObjectManager()->getMetadataFactory();
        $builder = new ClassMetadataBuilder($metadata);

        // Get the entity this entity audits
        $metadataClassName = $metadata->getName();
        $metadataClass = new $metadataClassName();
        $auditedClassName = $metadataClass->getAuditedEntityClass();

        $auditedClassMetadata = $metadataFactory->getMetadataFor($auditedClassName);
        $auditedClassName = $metadataClass->getAuditedEntityClass();

        // Is the passed class name a regular entity?
        if (! $this->getEntityConfigCollection()->containsKey($auditedClassName)) {
            return false;
        }

        // Add primary key
        $primaryKey = $builder->createField('_id', 'bigint')
            ->makePrimaryKey()
            ->generatedValue()
            ->unique()
            ->columnName('_id')
            ->build()
            ;

        $association = $builder->createManyToOne('revisionEntity', Entity\RevisionEntity::class);
        $association->build();

        // Add fields from target to audit entity
        foreach ($auditedClassMetadata->getFieldNames() as $fieldName) {
            $builder->addField(
                $fieldName,
                $auditedClassMetadata->getTypeOfField($fieldName),
                [
                    'columnName' => $auditedClassMetadata->getColumnName($fieldName),
                    'nullable' => true,
                    'quoted' => true
                ]
            );
        }

        foreach ($auditedClassMetadata->getAssociationMappings() as $mapping) {
            if (! $mapping['isOwningSide'] || isset($mapping['joinTable'])) {
                continue;
            }

            if (isset($mapping['joinTableColumns'])) {
                foreach ($mapping['joinTableColumns'] as $field) {
                    // FIXME:  set data type correct for mapping info
                    $builder->addField(
                        $mapping['fieldName'],
                        'bigint',
                        ['nullable' => true, 'columnName' => $field]
                    );
                }
            } elseif (isset($mapping['joinColumnFieldNames'])) {
                foreach ($mapping['joinColumnFieldNames'] as $field) {
                    // FIXME:  set data type correct for mapping info
                    $builder->addField(
                        $mapping['fieldName'],
                        'bigint',
                        ['nullable' => true, 'columnName' => $field]
                    );
                }
            } else {
                throw new Exception('Unhandled association mapping');
            }
        }

        $metadata->setTableName(
            $this->getAuditOptions()->getAuditTableNamePrefix()
                . $auditedClassMetadata->getTableName()
                . $this->getAuditOptions()->getAuditTableNameSuffix()
        );

        return;
    }
535236
public function getMetadataValue($identifier)
    {
        $metadata = $this->getMetadataValues();
        return isset($metadata[$identifier]) ? $metadata[$identifier] : null;
    }
1359353
public function loadMetadataForClass($className, ClassMetadataInfo $metadata)
    {
        $this->metadata = $metadata;
        $this->loadMappingFile($this->findMappingFile($className));
    }
636017
protected function _getMetaFromContent($metaIdent)
    {
        if ($metaIdent) {
            $content = oxNew(\OxidEsales\Eshop\Application\Model\Content::class);
            if ($content->loadByIdent($metaIdent) &&
                $content->oxcontents__oxactive->value
            ) {
                return getStr()->strip_tags($content->oxcontents__oxcontent->value);
            }
        }
    }
1035666
public function getValue($entity)
    {
        $meta = $this->metadataManager->getMetadata($entity);
        $identifier = $meta->getIdentifier();

        if (!$this->propertyAccessor->isReadable($entity, $identifier)) {
            throw new MetadataException(
                sprintf('Identifier "%s::$%s" is not readable.', ClassUtils::getClass($entity), $identifier)
            );
        }

        return $this->propertyAccessor->getValue($entity, $identifier);
    }
1170592
protected function _loadExistingClass($class, &$meta) {
        try {
            $reflector = new xPDOReflectionClass($class);

            $classHeader = rtrim($reflector->getSource(null, 0, $reflector->getStartLine() - 1, false), "\n");
            $classFooter = trim($reflector->getSource(null, $reflector->getEndLine(), null, false), " \n\r\t");
            if (!empty($classFooter)) $classFooter = rtrim($classFooter, "\n");

            $interfaces = $reflector->getInterfaceNames();
            if (!empty($interfaces)) {
                $interfaces = " implements " . implode(', ', $interfaces);
            } else {
                $interfaces = '';
            }

            $constants = $reflector->getConstants();

            $properties = array_filter($reflector->getProperties(), function($property) use ($class) {
                /* @var \ReflectionProperty $property */
                return $property->getDeclaringClass() === ltrim($class, '\\');
            });
            $methods = array_filter($reflector->getMethods(), function($method) use ($class) {
                /* @var \ReflectionMethod $method */
                return $method->getDeclaringClass() === ltrim($class, '\\');
            });

            $traitArray = array();
            if (version_compare(PHP_VERSION, '5.4', '>=')) {
                $traits = $reflector->getTraits();

                /* @var \ReflectionClass $trait */
                foreach ($traits as $trait) {
                    $traitArray[] = "    use \\{$trait->getName()};";
                }
            }

            $constantsArray = array();
            foreach ($constants as $constantKey => $constant) {
                $constantsArray[] = "    const {$constantKey} = " . static::varExport($constant) . ';';
            }

            $propertyArray = array();
            /* @var \ReflectionProperty $property */
            foreach ($properties as $property) {
                $propertyArray[] = $reflector->getSource($property);
            }

            $methodArray = array();
            /* @var \ReflectionMethod $method */
            foreach ($methods as $method) {
                $methodArray[] = $reflector->getSource($method);
            }

            $meta['class-header'] = "{$classHeader}\n";
            $meta['class-declaration'] = "class {$reflector->getShortName()} extends \\{$reflector->getParentClass()->getName()}{$interfaces}\n{";
            $meta['class-constants'] = implode("\n", $constantsArray);
            if (version_compare(PHP_VERSION, '5.4', '>=')) {
                $meta['class-traits'] = implode("\n", $traitArray);
            }
            $meta['class-properties'] = implode("\n", $propertyArray);
            $meta['class-methods'] = implode("\n", $methodArray);
            $meta['class-close-declaration'] = "}\n";
            $meta['class-footer'] = $classFooter;
        } catch (\Exception $e) {
            $this->manager->xpdo->log(xPDO::LOG_LEVEL_ERROR, $e->getMessage(), '', __METHOD__, __FILE__, __LINE__);
        }
    }
1212382
SourceMetadata loadSourceMetadata(Class<?> clazz) {
        SourceMetadata metadata = metadataMap.get(clazz);
        if (metadata == null) {
            metadata = new SourceMetadata(clazz);
            SourceMetadata found = metadataMap.putIfAbsent(clazz, metadata);
            metadata = found == null ? metadata : found;
        }

        return metadata;
    }
442230
public function metadataLoader()
    {
        if (!isset($this->metadataLoader)) {
            throw new RuntimeException(sprintf(
                'Metadata Loader is not defined for [%s]',
                get_class($this)
            ));
        }

        return $this->metadataLoader;
    }
151558
public static function loadValidatorMetadata(ClassMetadata $metadata)
    {
        $metadata->addPropertyConstraint(
            'options',
            new Assert\Collection(
                array(
                    'fields' => array(
                        'data' => array(
                            new Assert\NotBlank(),
                            new Assert\Type(
                                array(
                                    'type' => 'string',
                                )
                            ),
                        ),
                        'field' => array(
                            new Assert\NotBlank(),
                            new Assert\Type(
                                array(
                                    'type' => 'string',
                                )
                            ),
                        ),
                        'op'    => array(
                            new Assert\NotBlank(),
                            new Assert\Type(
                                array(
                                    'type' => 'string',
                                )
                            ),
                            new Assert\Choice(
                                array(
                                    'choices' => array(
                                        'bn',
                                        'bw',
                                        'cn',
                                        'en',
                                        'eq',
                                        'ew',
                                        'ge',
                                        'gt',
                                        'in',
                                        'le',
                                        'lt',
                                        'nc',
                                        'ne',
                                        'ni',
                                    )
                                )
                            ),
                        ),
                    ),
                )
            )
        );
    }
476564
public function handleMetadataLoad(MetadataLoadEvent $event)
    {
        if (ArticlePageDocument::class !== $event->getMetadata()->getClass()
            && !is_subclass_of($event->getMetadata()->getClass(), ArticlePageDocument::class)
        ) {
            return;
        }

        $metadata = $event->getMetadata();
        $metadata->setSyncRemoveLive(false);
        $metadata->addFieldMapping(
            'pageTitle',
            [
                'encoding' => 'system_localized',
                'property' => 'suluPageTitle',
            ]
        );
    }
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);
            
        }
        
    }
154421
private function loadFromSource($ident)
    {
        $obj = $this->factory->create($this->objType);
        if ($this->objKey) {
            $obj->loadFrom($this->objKey, $ident);
        } else {
            $obj->load($ident);
        }

        return $obj;
    }
512085
public static function injectIntoSettings($settings, $metadataInfo)
    {
        if (isset($metadataInfo['idp']) && isset($settings['idp'])) {
            if (isset($metadataInfo['idp']['x509certMulti']) && !empty($metadataInfo['idp']['x509certMulti']) && isset($settings['idp']['x509cert'])) {
                unset($settings['idp']['x509cert']);
            }

            if (isset($metadataInfo['idp']['x509cert']) && !empty($metadataInfo['idp']['x509cert']) && isset($settings['idp']['x509certMulti'])) {
                unset($settings['idp']['x509certMulti']);
            }
        }

        return array_replace_recursive($settings, $metadataInfo);
    }
732249
private function loadApiDefinition($forceReload = false)
    {
        $definitionLoader = $this->getDefinitionLoader();

        $supported = $definitionLoader->supports($this->options['uri']);

        if ($forceReload || ($this->definition == null && $supported)) {
            $this->definition = $definitionLoader->load($this->options['uri']);
        } elseif (!$supported) {
            throw new \RuntimeException("This resource (".$this->options['uri'].") is not supported.");
        }
    }
1300787
private function buildEntityCacheKey(ClassMetadata $metadata, $identifier)
    {
        if (! is_array($identifier)) {
            $identifier = $this->toIdentifierArray($metadata, $identifier);
        }

        return new EntityCacheKey($metadata->getRootClassName(), $identifier);
    }
451143
public static function loadValidatorMetadata(ClassMetadata $metadata)
    {
        $metadata->addPropertyConstraint('description', new Assert\NotBlank());
        $metadata->addPropertyConstraint('description', new Assert\Regex(array('pattern' => '/^[ a-zA-Z0-9]{1,64}$/')));

        $metadata->addPropertyConstraint('quantite', new Assert\NotBlank());
        $metadata->addPropertyConstraint('quantite', new Assert\Regex(array('pattern' => '/^[0-9]*$/')));

        $metadata->addPropertyConstraint('poids', new Assert\NotBlank());
        $metadata->addPropertyConstraint('poids', new Assert\Type(array('type' => 'float')));
        $metadata->addPropertyConstraint('poids', new Assert\Range(array('min' => 0, 'max' => 30)));

        $metadata->addPropertyConstraint('valeur', new Assert\NotBlank());
        $metadata->addPropertyConstraint('valeur', new Assert\Type(array('type' => 'float')));
    }