PHP Class Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory

This class was abstracted from the ORM ClassMetadataFactory
Since: 2.2
Author: Benjamin Eberlei ([email protected])
Author: Guilherme Blanco ([email protected])
Author: Jonathan Wage ([email protected])
Author: Roman Borschel ([email protected])
Inheritance: implements Doctrine\Common\Persistence\Mapping\ClassMetadataFactory
ファイルを表示 Open project: doctrine/common Class Usage Examples

Protected Properties

Property Type Description
$cacheSalt string Salt used by specific Object Manager implementation.
$initialized boolean

Public Methods

Method Description
getAllMetadata ( ) : array Forces the factory to load the metadata of all classes known to the underlying mapping driver.
getCacheDriver ( ) : Doctrine\Common\Cache\Cache | null Gets the cache driver used by the factory to cache ClassMetadata instances.
getLoadedMetadata ( ) : Doctrine\Common\Persistence\Mapping\ClassMetadata[] Returns an array of all the loaded metadata currently in memory.
getMetadataFor ( string $className ) : Doctrine\Common\Persistence\Mapping\ClassMetadata Gets the class metadata descriptor for a class.
getReflectionService ( ) : Doctrine\Common\Persistence\Mapping\ReflectionService Gets the reflection service associated with this metadata factory.
hasMetadataFor ( string $className ) : boolean Checks whether the factory has the metadata for a class loaded already.
isTransient ( $class ) {@inheritDoc}
setCacheDriver ( Doctrine\Common\Cache\Cache $cacheDriver = null ) : void Sets the cache driver used by the factory to cache ClassMetadata instances.
setMetadataFor ( string $className, Doctrine\Common\Persistence\Mapping\ClassMetadata $class ) : void Sets the metadata descriptor for a specific class.
setReflectionService ( Doctrine\Common\Persistence\Mapping\ReflectionService $reflectionService ) : void Sets the reflectionService.

Protected Methods

Method Description
doLoadMetadata ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class, Doctrine\Common\Persistence\Mapping\ClassMetadata | null $parent, boolean $rootEntityFound, array $nonSuperclassParents ) : void Actually loads the metadata from the underlying metadata.
getDriver ( ) : Doctrine\Common\Persistence\Mapping\Driver\MappingDriver Returns the mapping driver implementation.
getFqcnFromAlias ( string $namespaceAlias, string $simpleClassName ) : string Gets the fully qualified class-name from the namespace alias.
getParentClasses ( string $name ) : array Gets an array of parent classes for the given entity class.
initialize ( ) : void Lazy initialization of this stuff, especially the metadata driver, since these are not needed at all when a metadata cache is active.
initializeReflection ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class, Doctrine\Common\Persistence\Mapping\ReflectionService $reflService ) : void Initializes Reflection after ClassMetadata was constructed.
isEntity ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class ) : boolean Checks whether the class metadata is an entity.
loadMetadata ( string $name ) : array Loads the metadata of the class in question and all it's ancestors whose metadata is still not loaded.
newClassMetadataInstance ( string $className ) : Doctrine\Common\Persistence\Mapping\ClassMetadata Creates a new ClassMetadata instance for the given class name.
onNotFoundMetadata ( string $className ) : Doctrine\Common\Persistence\Mapping\ClassMetadata | null Provides a fallback hook for loading metadata when loading failed due to reflection/mapping exceptions
wakeupReflection ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class, Doctrine\Common\Persistence\Mapping\ReflectionService $reflService ) : void Wakes up reflection after ClassMetadata gets unserialized from cache.

Method Details

doLoadMetadata() abstract protected method

Actually loads the metadata from the underlying metadata.
abstract protected doLoadMetadata ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class, Doctrine\Common\Persistence\Mapping\ClassMetadata | null $parent, boolean $rootEntityFound, array $nonSuperclassParents ) : void
$class Doctrine\Common\Persistence\Mapping\ClassMetadata
$parent Doctrine\Common\Persistence\Mapping\ClassMetadata | null
$rootEntityFound boolean
$nonSuperclassParents array All parent class names that are not marked as mapped superclasses.
return void

getAllMetadata() public method

Forces the factory to load the metadata of all classes known to the underlying mapping driver.
public getAllMetadata ( ) : array
return array The ClassMetadata instances of all mapped classes.

getCacheDriver() public method

Gets the cache driver used by the factory to cache ClassMetadata instances.
public getCacheDriver ( ) : Doctrine\Common\Cache\Cache | null
return Doctrine\Common\Cache\Cache | null

getDriver() abstract protected method

Returns the mapping driver implementation.
abstract protected getDriver ( ) : Doctrine\Common\Persistence\Mapping\Driver\MappingDriver
return Doctrine\Common\Persistence\Mapping\Driver\MappingDriver

getFqcnFromAlias() abstract protected method

Gets the fully qualified class-name from the namespace alias.
abstract protected getFqcnFromAlias ( string $namespaceAlias, string $simpleClassName ) : string
$namespaceAlias string
$simpleClassName string
return string

getLoadedMetadata() public method

Returns an array of all the loaded metadata currently in memory.
public getLoadedMetadata ( ) : Doctrine\Common\Persistence\Mapping\ClassMetadata[]
return Doctrine\Common\Persistence\Mapping\ClassMetadata[]

getMetadataFor() public method

Gets the class metadata descriptor for a class.
public getMetadataFor ( string $className ) : Doctrine\Common\Persistence\Mapping\ClassMetadata
$className string The name of the class.
return Doctrine\Common\Persistence\Mapping\ClassMetadata

getParentClasses() protected method

Gets an array of parent classes for the given entity class.
protected getParentClasses ( string $name ) : array
$name string
return array

getReflectionService() public method

Gets the reflection service associated with this metadata factory.
public getReflectionService ( ) : Doctrine\Common\Persistence\Mapping\ReflectionService
return Doctrine\Common\Persistence\Mapping\ReflectionService

hasMetadataFor() public method

Checks whether the factory has the metadata for a class loaded already.
public hasMetadataFor ( string $className ) : boolean
$className string
return boolean TRUE if the metadata of the class in question is already loaded, FALSE otherwise.

initialize() abstract protected method

Lazy initialization of this stuff, especially the metadata driver, since these are not needed at all when a metadata cache is active.
abstract protected initialize ( ) : void
return void

initializeReflection() abstract protected method

Initializes Reflection after ClassMetadata was constructed.
abstract protected initializeReflection ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class, Doctrine\Common\Persistence\Mapping\ReflectionService $reflService ) : void
$class Doctrine\Common\Persistence\Mapping\ClassMetadata
$reflService Doctrine\Common\Persistence\Mapping\ReflectionService
return void

isEntity() abstract protected method

This method should return false for mapped superclasses or embedded classes.
abstract protected isEntity ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class ) : boolean
$class Doctrine\Common\Persistence\Mapping\ClassMetadata
return boolean

isTransient() public method

{@inheritDoc}
public isTransient ( $class )

loadMetadata() protected method

Important: The class $name does not necesarily exist at this point here. Scenarios in a code-generation setup might have access to XML/YAML Mapping files without the actual PHP code existing here. That is why the {@see \Doctrine\Common\Persistence\Mapping\ReflectionService} interface should be used for reflection.
protected loadMetadata ( string $name ) : array
$name string The name of the class for which the metadata should get loaded.
return array

newClassMetadataInstance() abstract protected method

Creates a new ClassMetadata instance for the given class name.
abstract protected newClassMetadataInstance ( string $className ) : Doctrine\Common\Persistence\Mapping\ClassMetadata
$className string
return Doctrine\Common\Persistence\Mapping\ClassMetadata

onNotFoundMetadata() protected method

Override this method to implement a fallback strategy for failed metadata loading
protected onNotFoundMetadata ( string $className ) : Doctrine\Common\Persistence\Mapping\ClassMetadata | null
$className string
return Doctrine\Common\Persistence\Mapping\ClassMetadata | null

setCacheDriver() public method

Sets the cache driver used by the factory to cache ClassMetadata instances.
public setCacheDriver ( Doctrine\Common\Cache\Cache $cacheDriver = null ) : void
$cacheDriver Doctrine\Common\Cache\Cache
return void

setMetadataFor() public method

NOTE: This is only useful in very special cases, like when generating proxy classes.
public setMetadataFor ( string $className, Doctrine\Common\Persistence\Mapping\ClassMetadata $class ) : void
$className string
$class Doctrine\Common\Persistence\Mapping\ClassMetadata
return void

setReflectionService() public method

Sets the reflectionService.
public setReflectionService ( Doctrine\Common\Persistence\Mapping\ReflectionService $reflectionService ) : void
$reflectionService Doctrine\Common\Persistence\Mapping\ReflectionService
return void

wakeupReflection() abstract protected method

Wakes up reflection after ClassMetadata gets unserialized from cache.
abstract protected wakeupReflection ( Doctrine\Common\Persistence\Mapping\ClassMetadata $class, Doctrine\Common\Persistence\Mapping\ReflectionService $reflService ) : void
$class Doctrine\Common\Persistence\Mapping\ClassMetadata
$reflService Doctrine\Common\Persistence\Mapping\ReflectionService
return void

Property Details

$cacheSalt protected_oe property

Salt used by specific Object Manager implementation.
protected string $cacheSalt
return string

$initialized protected_oe property

protected bool $initialized
return boolean