Initializes a new View instance that will hold the object-relational
mapping of the class with the given name.

@param string $itemClass The name of the item class the new instance is used for.
return ItemMetaData
15786
public static function initFromItemClass($itemClass)
	{
		$itemMetaData = new ItemMetaData();
		$itemMetaData->setItemClass($itemClass);
		$contruct = new ReflectionMethod($itemClass, '__construct');
		/* @var $param \ReflectionParameter */
		foreach($contruct->getParameters() as $key => $param)
		{
			$itemMetaData->setHitPosition($param->getName(), $key);
			if(!$param->isOptional())
			{
				$itemMetaData->addRequiredHit($param->getName());
			}
		}
		return $itemMetaData;
	}
476990
private function parseClassMetadata($class)
    {
        $metadata = new ClassMetadata($class);

        //Load up parent and interfaces
        $this->loadParentMetadata($metadata);
        $this->loadInterfaceMetadata($metadata);

        //Load Annotations from Reader
        $this->loader->loadClassMetadata($metadata);

        //Store internally
        $this->setParsedClass($class, $metadata);

        if ($this->cache !== null) {
            $this->cache->save($class, $metadata);
        }

        return $metadata;
    }
104720
private function initCollection(string $collection, string $class = null): void
    {
        $this->$collection = new Collection();
        $this->$collection->macroObject('createItem',
            function () use ($class): ?Assignable {
                if (null === $class) {
                    return null;
                }
                if (!class_exists($class)) {
                    throw new InvalidArgumentException(sprintf('Can not load class: %s', $class));
                }
                $item = new $class;
                if (!$item instanceof Assignable) {
                    throw new InvalidArgumentException(sprintf('%s must implement Assignable', $class));
                }

                return $item;
            });
    }
30371
private function initializeMethodNamesMap($class)
    {
        $this->serviceIdToMethodNameMap = array();
        $this->usedMethodNames = array();

        try {
            $reflectionClass = new \ReflectionClass($class);
            foreach ($reflectionClass->getMethods() as $method) {
                $this->usedMethodNames[strtolower($method->getName())] = true;
            }
        } catch (\ReflectionException $e) {
        }
    }
740131
def _init_metadata(self):
        """"""
        ItemTextsFormRecord._init_metadata(self)
        ItemFilesFormRecord._init_metadata(self)
        edXBaseFormRecord._init_metadata(self)
        IRTItemFormRecord._init_metadata(self)
        TimeValueFormRecord._init_metadata(self)
        ProvenanceFormRecord._init_metadata(self)
        super(edXItemFormRecord, self)._init_metadata()
795657
private function loadTranslatableMetadata(\ReflectionClass $class) {
        $classMetadata = new TranslatableMetadata($class->name);

        foreach ($class->getProperties() as $property) {
            if ($property->class !== $class->name) {
                continue;
            }

            $propertyMetadata = new PropertyMetadata($class->name, $property->getName());

            if ($this->reader->getPropertyAnnotation($property, 'Prezent\\Doctrine\\Translatable\\Annotation\\CurrentLocale')) {
                $classMetadata->currentLocale = $propertyMetadata;
                $classMetadata->addPropertyMetadata($propertyMetadata);
            }
            
            if ($this->reader->getPropertyAnnotation($property, 'Prezent\\Doctrine\\Translatable\\Annotation\\FallbackLocale')) {
                $classMetadata->fallbackLocale = $propertyMetadata;
                $classMetadata->addPropertyMetadata($propertyMetadata);
            }
            
            if ($annot = $this->reader->getPropertyAnnotation($property, 'Prezent\\Doctrine\\Translatable\\Annotation\\Translations')) {
                $classMetadata->targetEntity = $annot->targetEntity;
                $classMetadata->translations = $propertyMetadata;
                $classMetadata->addPropertyMetadata($propertyMetadata);
            }
        }

        return $classMetadata;
    }
579522
private function getFromCache(string $class): ?ClassMetadataInterface
    {
        if (null === $this->cache) {
            return null;
        }

        if ($this->cache instanceof Cache) {
            $cached = $this->cache->fetch($class) ?: null;
        } else {
            $class = preg_replace('#[\{\}\(\)/\\\\@:]#', '_', str_replace('_', '__', $class));
            $item = $this->cache->getItem($class);
            $cached = $item->isHit() ? $item->get() : null;
        }

        return $cached;
    }
346398
public <E extends T> OnItemBindClass<T> map(@NonNull Class<E> itemClass, @NonNull OnItemBind<E> onItemBind) {
        int index = itemBindingClassList.indexOf(itemClass);
        if (index >= 0) {
            itemBindingList.set(index, onItemBind);
        } else {
            itemBindingClassList.add(itemClass);
            itemBindingList.add(onItemBind);
        }
        return this;
    }
869149
public function asXml(Shopgate_Model_XmlResultObject $itemNode)
    {
        /**
         * @var Shopgate_Model_XmlResultObject $relationNode
         */
        $relationNode = $itemNode->addChild('relation');
        $relationNode->addAttribute('type', $this->getType());
        if ($this->getType() == self::DEFAULT_RELATION_TYPE_CUSTOM) {
            $relationNode->addChildWithCDATA('label', $this->getLabel());
        }
        foreach ($this->getValues() as $value) {
            $relationNode->addChild('uid', $value);
        }

        return $itemNode;
    }
1341510
protected function transformMetadata($class)
    {
        $class = clone $class;

        $className = $class->getName();

        $ghostClassName =$class->name;
//        $class->namespace = 'Opifer\\Revisions\\Entity';
//         = $ghostClassName;
//        $class->rootEntityName = $class->name;
        $class->inheritanceType = ClassMetadataInfo::INHERITANCE_TYPE_NONE;

        $class->parentClasses = null;
        $class->discriminatorMap = null;
        $class->discriminatorColumn = null;

        $class->setPrimaryTable(['name' => $class->getTableName() . '_revisions']);
//        $this->name = $entityName;
//        $this->rootEntityName = $entityName;

        foreach ($class->fieldMappings as $key => $fieldMapping) {
            $class->fieldMappings[$fieldMapping['fieldName']]['inherited'] = $ghostClassName;
            $class->fieldMappings[$fieldMapping['fieldName']]['declared'] = $ghostClassName;

            if (! $this->annotationReader->isPropertyRevised($className, $fieldMapping['fieldName']) &&
                ! $class->isIdentifier($fieldMapping['fieldName'])) {
                unset($class->fieldMappings[$fieldMapping['fieldName']]);
                unset($class->fieldNames[$fieldMapping['columnName']]);
                unset($class->columnNames[$fieldMapping['fieldName']]);
                unset($class->reflFields[$fieldMapping['fieldName']]);
            }
        }

        foreach ($class->associationMappings as $key => $associationMapping) {
            $class->associationMappings[$associationMapping['fieldName']]['inherited'] = $ghostClassName;
            $class->associationMappings[$associationMapping['fieldName']]['declared'] = $ghostClassName;

            if (! $this->annotationReader->isPropertyRevised($className, $associationMapping['fieldName']) &&
                ! $class->isIdentifier($associationMapping['fieldName'])) {
                unset($class->associationMappings[$associationMapping['fieldName']]);
                unset($class->reflFields[$associationMapping['fieldName']]);
            }
        }

//        if (! isset($class->fieldMappings['revisionId'])) {
//            $revisionMapping = [
//                'fieldName' => 'revisionId',
//                'columnName' => 'revision_id',
//                'type' => 'integer',
//            ];
//
//            $class->mapField($revisionMapping);
//            $this->addReflectionField($class, $revisionMapping['fieldName']);
//
//            $revisionMapping = [
//                'fieldName' => 'revisionType',
//                'columnName' => 'rev_type',
//                'type' => 'string',
//            ];
//
//            $class->mapField($revisionMapping);
//            $this->addReflectionField($class, $revisionMapping['fieldName']);
//
//            $revisionMapping = [
//                'fieldName' => 'draft',
//                'columnName' => 'draft',
//                'type' => 'boolean',
//            ];
//
//            $class->mapField($revisionMapping);
//            $this->addReflectionField($class, $revisionMapping['fieldName']);
//        }

//        $mock = new $ghostClassName;
//        foreach ($class->reflFields as $key => $reflectionProperty) {
//            $mock->$key = null;
//            $class->reflFields[$key] = new \ReflectionProperty($mock, $key);
//        }

        return $class;
    }
365566
private function getDoctrineMetadata($entityClass)
    {
        if (!isset($this->doctrineMetadata[$entityClass])) {
            try {
                $this->doctrineMetadata[$entityClass] = $this->em->getClassMetadata($entityClass);
            } catch (MappingException $ex) {
                throw new FiltererException(sprintf('Unable to get Doctrine metadata for class "%s".', $entityClass));
            }
        }

        return $this->doctrineMetadata[$entityClass];
    }
297466
public function setListItemCssClass($class)
    {
        if (!is_string($class)) {
            throw new \InvalidArgumentException(
                'Breadcrumbs::setListItemCssClass() only accepts strings, but '
                . (is_object($class) ? get_class($class) : gettype($class))
                . ' given: ' . print_r($class, true)
            );
        }

        $this->listItemCssClass = $class;

        return $this;
    }
80111
protected function loadAssociationObjectsToObject(array $item, $object)
    {
        foreach ($this->objectMetadata->getAssociationMappings() as $associationMapping) {

            $value = null;
            if (isset($item[$associationMapping['fieldName']]) && !is_object($item[$associationMapping['fieldName']])) {
                $value = $this->objectManager->getReference($associationMapping['targetEntity'], $item[$associationMapping['fieldName']]);
            }

            if (null === $value) {
                continue;
            }

            $setter = 'set' . ucfirst($associationMapping['fieldName']);
            $this->setValue($object, $value, $setter);
        }
    }
1180499
public function whenCreating($class)
    {
        if (!isset($this->args[$class])) {
            $this->args[$class] = new ClassMeta($class, $this);
        }

        return $this->args[$class];
    }
187747
public function setModelClass($class)
    {
        $this->getTabs()->each(function (TabInterface $tab) use ($class) {
            if ($tab instanceof DisplayInterface) {
                $tab->setModelClass($class);
            }
        });

        return $this;
    }
571168
private function newInstance($class)
    {
        $entity = $class->newInstance();

        if ($entity instanceof \Doctrine\Common\Persistence\ObjectManagerAware) {
            $entity->injectObjectManager($this->em, $class);
        }

        return $entity;
    }
709122
public static function initializeClass($class)
    {
        try
        {
            // Get a static method named 'initialize'. If not found,
            // ReflectionMethod() will throw a ReflectionException.
            $ref = new \ReflectionMethod($class, 'initialize');

            // The 'initialize' method is probably 'private'.
            // Make it accessible before calling 'invoke'.
            // Note that 'setAccessible' is not available
            // before PHP version 5.3.2.
            $ref->setAccessible(true);

            // Execute the 'initialize' method.
            $ref->invoke(null);
        }
        catch (Exception $e)
        {
        }
    }