AbstractDoctrineExtension
extends Extension
in package
This abstract classes groups common code that Doctrine Object Manager extensions (ORM, MongoDB, CouchDB) need.
Tags
Table of Contents
- $aliasMap : mixed
- Used inside metadata driver method to simplify aggregation of data.
- $drivers : mixed
- Used inside metadata driver method to simplify aggregation of data.
- $annotatedClasses : mixed
- $processedConfigs : mixed
- addAnnotatedClassesToCompile() : mixed
- Adds annotated classes to the class cache.
- getAlias() : string
- Returns the recommended alias to use in XML.
- getAnnotatedClassesToCompile() : array<string|int, mixed>
- Gets the annotated classes to cache.
- getConfiguration() : ConfigurationInterface|null
- Returns extension configuration.
- getNamespace() : string
- Returns the namespace to be used for this extension (XML namespace).
- getXsdValidationBasePath() : string|false
- Returns the base path for the XSD files.
- assertValidMappingConfiguration() : mixed
- Assertion if the specified mapping information is valid.
- detectMetadataDriver() : string|null
- Detects what metadata driver to use for the supplied directory.
- fixManagersAutoMappings() : array<string|int, mixed>
- Returns a modified version of $managerConfigs.
- getMappingDriverBundleConfigDefaults() : array<string|int, mixed>|false
- If this is a bundle controlled mapping all the missing information can be autodetected by this method.
- getMappingObjectDefaultName() : string
- Noun that describes the mapped objects such as Entity or Document.
- getMappingResourceConfigDirectory() : string
- Relative path from the bundle root to the directory where mapping files reside.
- getMappingResourceExtension() : string
- Extension used by the mapping files.
- getMetadataDriverClass() : string
- The class name used by the various mapping drivers.
- getObjectManagerElementName() : string
- Prefixes the relative dependency injection container path with the object manager prefix.
- isConfigEnabled() : bool
- loadCacheDriver() : string
- Loads a cache driver.
- loadMappingInformation() : mixed
- loadObjectManagerCacheDriver() : mixed
- Loads a configured object manager metadata, query or result cache driver.
- processConfiguration() : array<string|int, mixed>
- registerMappingDrivers() : mixed
- Register all the collected mapping information with the object manager by registering the appropriate mapping drivers.
- setMappingDriverAlias() : mixed
- Register the alias for this mapping driver.
- setMappingDriverConfig() : mixed
- Register the mapping driver configuration for later use with the object managers metadata driver chain.
- validateAutoMapping() : string|null
- Search for a manager that is declared as 'auto_mapping' = true.
Properties
$aliasMap
Used inside metadata driver method to simplify aggregation of data.
protected
mixed
$aliasMap
= []
$drivers
Used inside metadata driver method to simplify aggregation of data.
protected
mixed
$drivers
= []
$annotatedClasses
private
mixed
$annotatedClasses
= []
$processedConfigs
private
mixed
$processedConfigs
= []
Methods
addAnnotatedClassesToCompile()
Adds annotated classes to the class cache.
public
addAnnotatedClassesToCompile(array<string|int, mixed> $annotatedClasses) : mixed
Parameters
- $annotatedClasses : array<string|int, mixed>
-
An array of class patterns
Return values
mixed —getAlias()
Returns the recommended alias to use in XML.
public
getAlias() : string
This alias is also the mandatory prefix to use when using YAML.
This convention is to remove the "Extension" postfix from the class name and then lowercase and underscore the result. So:
AcmeHelloExtension
becomes
acme_hello
This can be overridden in a sub-class to specify the alias manually.
Tags
Return values
string —getAnnotatedClassesToCompile()
Gets the annotated classes to cache.
public
getAnnotatedClassesToCompile() : array<string|int, mixed>
Return values
array<string|int, mixed> —An array of classes
getConfiguration()
Returns extension configuration.
public
getConfiguration(array<string|int, mixed> $config, ContainerBuilder $container) : ConfigurationInterface|null
Parameters
- $config : array<string|int, mixed>
- $container : ContainerBuilder
Return values
ConfigurationInterface|null —getNamespace()
Returns the namespace to be used for this extension (XML namespace).
public
getNamespace() : string
Return values
string —getXsdValidationBasePath()
Returns the base path for the XSD files.
public
getXsdValidationBasePath() : string|false
Return values
string|false —assertValidMappingConfiguration()
Assertion if the specified mapping information is valid.
protected
assertValidMappingConfiguration(array<string|int, mixed> $mappingConfig, string $objectManagerName) : mixed
Parameters
- $mappingConfig : array<string|int, mixed>
- $objectManagerName : string
Tags
Return values
mixed —detectMetadataDriver()
Detects what metadata driver to use for the supplied directory.
protected
detectMetadataDriver(string $dir, ContainerBuilder $container) : string|null
Parameters
- $dir : string
-
A directory path
- $container : ContainerBuilder
Return values
string|null —A metadata driver short name, if one can be detected
fixManagersAutoMappings()
Returns a modified version of $managerConfigs.
protected
fixManagersAutoMappings(array<string|int, mixed> $managerConfigs, array<string|int, mixed> $bundles) : array<string|int, mixed>
The manager called $autoMappedManager will map all bundles that are not mapped by other managers.
Parameters
- $managerConfigs : array<string|int, mixed>
- $bundles : array<string|int, mixed>
Return values
array<string|int, mixed> —The modified version of $managerConfigs
getMappingDriverBundleConfigDefaults()
If this is a bundle controlled mapping all the missing information can be autodetected by this method.
protected
getMappingDriverBundleConfigDefaults(array<string|int, mixed> $bundleConfig, ReflectionClass $bundle, ContainerBuilder $container) : array<string|int, mixed>|false
Returns false when autodetection failed, an array of the completed information otherwise.
Parameters
- $bundleConfig : array<string|int, mixed>
- $bundle : ReflectionClass
- $container : ContainerBuilder
Return values
array<string|int, mixed>|false —getMappingObjectDefaultName()
Noun that describes the mapped objects such as Entity or Document.
protected
abstract getMappingObjectDefaultName() : string
Will be used for autodetection of persistent objects directory.
Return values
string —getMappingResourceConfigDirectory()
Relative path from the bundle root to the directory where mapping files reside.
protected
abstract getMappingResourceConfigDirectory() : string
Return values
string —getMappingResourceExtension()
Extension used by the mapping files.
protected
abstract getMappingResourceExtension() : string
Return values
string —getMetadataDriverClass()
The class name used by the various mapping drivers.
protected
getMetadataDriverClass(string $driverType) : string
Parameters
- $driverType : string
Return values
string —getObjectManagerElementName()
Prefixes the relative dependency injection container path with the object manager prefix.
protected
abstract getObjectManagerElementName(string $name) : string
Parameters
- $name : string
Tags
Return values
string —isConfigEnabled()
protected
isConfigEnabled(ContainerBuilder $container, array<string|int, mixed> $config) : bool
Parameters
- $container : ContainerBuilder
- $config : array<string|int, mixed>
Tags
Return values
bool —loadCacheDriver()
Loads a cache driver.
protected
loadCacheDriver(string $cacheName, string $objectManagerName, array<string|int, mixed> $cacheDriver, ContainerBuilder $container) : string
Parameters
- $cacheName : string
-
The cache driver name
- $objectManagerName : string
-
The object manager name
- $cacheDriver : array<string|int, mixed>
-
The cache driver mapping
- $container : ContainerBuilder
Tags
Return values
string —loadMappingInformation()
protected
loadMappingInformation(array<string|int, mixed> $objectManager, ContainerBuilder $container) : mixed
Parameters
- $objectManager : array<string|int, mixed>
-
A configured object manager
- $container : ContainerBuilder
Tags
Return values
mixed —loadObjectManagerCacheDriver()
Loads a configured object manager metadata, query or result cache driver.
protected
loadObjectManagerCacheDriver(array<string|int, mixed> $objectManager, ContainerBuilder $container, string $cacheName) : mixed
Parameters
- $objectManager : array<string|int, mixed>
-
A configured object manager
- $container : ContainerBuilder
- $cacheName : string
Tags
Return values
mixed —processConfiguration()
protected
final processConfiguration(ConfigurationInterface $configuration, array<string|int, mixed> $configs) : array<string|int, mixed>
Parameters
- $configuration : ConfigurationInterface
- $configs : array<string|int, mixed>
Return values
array<string|int, mixed> —registerMappingDrivers()
Register all the collected mapping information with the object manager by registering the appropriate mapping drivers.
protected
registerMappingDrivers(array<string|int, mixed> $objectManager, ContainerBuilder $container) : mixed
Parameters
- $objectManager : array<string|int, mixed>
- $container : ContainerBuilder
Return values
mixed —setMappingDriverAlias()
Register the alias for this mapping driver.
protected
setMappingDriverAlias(array<string|int, mixed> $mappingConfig, string $mappingName) : mixed
Aliases can be used in the Query languages of all the Doctrine object managers to simplify writing tasks.
Parameters
- $mappingConfig : array<string|int, mixed>
- $mappingName : string
Return values
mixed —setMappingDriverConfig()
Register the mapping driver configuration for later use with the object managers metadata driver chain.
protected
setMappingDriverConfig(array<string|int, mixed> $mappingConfig, string $mappingName) : mixed
Parameters
- $mappingConfig : array<string|int, mixed>
- $mappingName : string
Tags
Return values
mixed —validateAutoMapping()
Search for a manager that is declared as 'auto_mapping' = true.
private
validateAutoMapping(array<string|int, mixed> $managerConfigs) : string|null
Parameters
- $managerConfigs : array<string|int, mixed>