abstract class AbstractClassMetadataFactory implements ClassMetadataFactory (View source)

The ClassMetadataFactory is used to create ClassMetadata objects that contain all the metadata mapping informations of a class which describes how a class should be mapped to a relational database.

This class was abstracted from the ORM ClassMetadataFactory

Properties

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

Methods

setCacheDriver(Cache $cacheDriver = null)

Sets the cache driver used by the factory to cache ClassMetadata instances.

Cache
getCacheDriver()

Gets the cache driver used by the factory to cache ClassMetadata instances.

array
getLoadedMetadata()

Return an array of all the loaded metadata currently in memory.

array
getAllMetadata()

Forces the factory to load the metadata of all classes known to the underlying mapping driver.

void
initialize()

Lazy initialization of this stuff, especially the metadata driver, since these are not needed at all when a metadata cache is active.

string
getFqcnFromAlias(string $namespaceAlias, string $simpleClassName)

Get the fully qualified class-name from the namespace alias.

getDriver()

Return the mapping driver implementation.

void
wakeupReflection(ClassMetadata $class, ReflectionService $reflService)

Wakeup reflection after ClassMetadata gets unserialized from cache.

void
initializeReflection(ClassMetadata $class, ReflectionService $reflService)

Initialize Reflection after ClassMetadata was constructed.

boolean
isEntity(ClassMetadata $class)

Checks whether the class metadata is an entity.

getMetadataFor(string $className)

Gets the class metadata descriptor for a class.

boolean
hasMetadataFor(string $className)

Checks whether the factory has the metadata for a class loaded already.

setMetadataFor(string $className, ClassMetadata $class)

Sets the metadata descriptor for a specific class.

array
getParentClasses(string $name)

Get array of parent classes for the given entity class

array
loadMetadata(string $name)

Loads the metadata of the class in question and all it's ancestors whose metadata is still not loaded.

void
doLoadMetadata(ClassMetadata $class, ClassMetadata|null $parent, bool $rootEntityFound, array $nonSuperclassParents)

Actually load the metadata from the underlying metadata

newClassMetadataInstance(string $className)

Creates a new ClassMetadata instance for the given class name.

boolean
isTransient($class)

Check if this class is mapped by this Object Manager + ClassMetadata configuration

setReflectionService(ReflectionService $reflectionService)

Set reflectionService.

getReflectionService()

Get the reflection service associated with this metadata factory.

Details

setCacheDriver(Cache $cacheDriver = null)

Sets the cache driver used by the factory to cache ClassMetadata instances.

Parameters

Cache $cacheDriver

Cache getCacheDriver()

Gets the cache driver used by the factory to cache ClassMetadata instances.

Return Value

Cache

array getLoadedMetadata()

Return an array of all the loaded metadata currently in memory.

Return Value

array

array getAllMetadata()

Forces the factory to load the metadata of all classes known to the underlying mapping driver.

Return Value

array The ClassMetadata instances of all mapped classes.

abstract protected void initialize()

Lazy initialization of this stuff, especially the metadata driver, since these are not needed at all when a metadata cache is active.

Return Value

void

abstract protected string getFqcnFromAlias(string $namespaceAlias, string $simpleClassName)

Get the fully qualified class-name from the namespace alias.

Parameters

string $namespaceAlias
string $simpleClassName

Return Value

string

abstract protected MappingDriver getDriver()

Return the mapping driver implementation.

Return Value

MappingDriver

abstract protected void wakeupReflection(ClassMetadata $class, ReflectionService $reflService)

Wakeup reflection after ClassMetadata gets unserialized from cache.

Parameters

ClassMetadata $class
ReflectionService $reflService

Return Value

void

abstract protected void initializeReflection(ClassMetadata $class, ReflectionService $reflService)

Initialize Reflection after ClassMetadata was constructed.

Parameters

ClassMetadata $class
ReflectionService $reflService

Return Value

void

abstract protected boolean isEntity(ClassMetadata $class)

Checks whether the class metadata is an entity.

This method should false for mapped superclasses or embedded classes.

Parameters

ClassMetadata $class

Return Value

boolean

ClassMetadata getMetadataFor(string $className)

Gets the class metadata descriptor for a class.

Parameters

string $className The name of the class.

Return Value

ClassMetadata

boolean hasMetadataFor(string $className)

Checks whether the factory has the metadata for a class loaded already.

Parameters

string $className

Return Value

boolean TRUE if the metadata of the class in question is already loaded, FALSE otherwise.

setMetadataFor(string $className, ClassMetadata $class)

Sets the metadata descriptor for a specific class.

NOTE: This is only useful in very special cases, like when generating proxy classes.

Parameters

string $className
ClassMetadata $class

protected array getParentClasses(string $name)

Get array of parent classes for the given entity class

Parameters

string $name

Return Value

array $parentClasses

protected array loadMetadata(string $name)

Loads the metadata of the class in question and all it's ancestors whose metadata is still not loaded.

Parameters

string $name The name of the class for which the metadata should get loaded.

Return Value

array

abstract protected void doLoadMetadata(ClassMetadata $class, ClassMetadata|null $parent, bool $rootEntityFound, array $nonSuperclassParents)

Actually load the metadata from the underlying metadata

Parameters

ClassMetadata $class
ClassMetadata|null $parent
bool $rootEntityFound
array $nonSuperclassParents classnames all parent classes that are not marked as mapped superclasses

Return Value

void

abstract protected ClassMetadata newClassMetadataInstance(string $className)

Creates a new ClassMetadata instance for the given class name.

Parameters

string $className

Return Value

ClassMetadata

boolean isTransient($class)

Check if this class is mapped by this Object Manager + ClassMetadata configuration

Parameters

$class

Return Value

boolean

setReflectionService(ReflectionService $reflectionService)

Set reflectionService.

Parameters

ReflectionService $reflectionService

ReflectionService getReflectionService()

Get the reflection service associated with this metadata factory.

Return Value

ReflectionService