AbstractDoctrineExtension
extends Extension
in package
This abstract classes groups common code that Doctrine Object Manager extensions (ORM, MongoDB, CouchDB) need.
Tags
Table of Contents
Properties
- $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 : array<string|int, mixed>
- $processedConfigs : array<string|int, mixed>
Methods
- 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.
- detectMappingType() : string
- Detects what mapping type to use for the supplied directory.
- 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
array<string|int, mixed>
$annotatedClasses
= []
$processedConfigs
private
array<string|int, 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
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
stringgetAnnotatedClassesToCompile()
Gets the annotated classes to cache.
public
getAnnotatedClassesToCompile() : array<string|int, mixed>
Return values
array<string|int, mixed>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|nullgetNamespace()
Returns the namespace to be used for this extension (XML namespace).
public
getNamespace() : string
Return values
stringgetXsdValidationBasePath()
Returns the base path for the XSD files.
public
getXsdValidationBasePath() : string|false
Return values
string|falseassertValidMappingConfiguration()
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
detectMetadataDriver()
Detects what metadata driver to use for the supplied directory.
protected
detectMetadataDriver(string $dir, ContainerBuilder $container) : string|null
Parameters
- $dir : string
- $container : ContainerBuilder
Return values
string|nullfixManagersAutoMappings()
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>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[, string $bundleDir = null ]) : 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
- $bundleDir : string = null
Return values
array<string|int, mixed>|falsegetMappingObjectDefaultName()
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
stringgetMappingResourceConfigDirectory()
Relative path from the bundle root to the directory where mapping files reside.
protected
abstract getMappingResourceConfigDirectory([string $bundleDir = null ]) : string
Parameters
- $bundleDir : string = null
Return values
stringgetMappingResourceExtension()
Extension used by the mapping files.
protected
abstract getMappingResourceExtension() : string
Return values
stringgetMetadataDriverClass()
The class name used by the various mapping drivers.
protected
abstract getMetadataDriverClass(string $driverType) : string
Parameters
- $driverType : string
Return values
stringgetObjectManagerElementName()
Prefixes the relative dependency injection container path with the object manager prefix.
protected
abstract getObjectManagerElementName(string $name) : string
Parameters
- $name : string
Tags
Return values
stringisConfigEnabled()
protected
isConfigEnabled(ContainerBuilder $container, array<string|int, mixed> $config) : bool
Parameters
- $container : ContainerBuilder
- $config : array<string|int, mixed>
Tags
Return values
boolloadCacheDriver()
Loads a cache driver.
protected
loadCacheDriver(string $cacheName, string $objectManagerName, array<string|int, mixed> $cacheDriver, ContainerBuilder $container) : string
Parameters
- $cacheName : string
- $objectManagerName : string
- $cacheDriver : array<string|int, mixed>
- $container : ContainerBuilder
Tags
Return values
stringloadMappingInformation()
protected
loadMappingInformation(array<string|int, mixed> $objectManager, ContainerBuilder $container) : mixed
Parameters
- $objectManager : array<string|int, mixed>
-
A configured object manager
- $container : ContainerBuilder
Tags
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>
- $container : ContainerBuilder
- $cacheName : string
Tags
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
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
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
detectMappingType()
Detects what mapping type to use for the supplied directory.
private
detectMappingType(string $directory, ContainerBuilder $container) : string
Parameters
- $directory : string
- $container : ContainerBuilder
Return values
string —A mapping type 'attribute' or 'annotation'
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>