abstract class AbstractDoctrineExtension extends Extension

This abstract classes groups common code that Doctrine Object Manager extensions (ORM, MongoDB, CouchDB) need.

Properties

protected $aliasMap Used inside metadata driver method to simplify aggregation of data.
protected $drivers Used inside metadata driver method to simplify aggregation of data.

Methods

string
getXsdValidationBasePath()

Returns the base path for the XSD files.

from Extension
string
getNamespace()

Returns the namespace to be used for this extension (XML namespace).

from Extension
string
getAlias()

Returns the recommended alias to use in XML.

from Extension
getConfiguration(array $config, ContainerBuilder $container)

Returns extension configuration.

from Extension
processConfiguration(ConfigurationInterface $configuration, array $configs)

No description

from Extension
getProcessedConfigs()

No description

from Extension
bool
isConfigEnabled(ContainerBuilder $container, array $config)

No description

from Extension
array
getAnnotatedClassesToCompile()

Gets the annotated classes to cache.

from Extension
addAnnotatedClassesToCompile(array $annotatedClasses)

Adds annotated classes to the class cache.

from Extension
loadMappingInformation(array $objectManager, ContainerBuilder $container)

No description

setMappingDriverAlias(array $mappingConfig, string $mappingName)

Register the alias for this mapping driver.

setMappingDriverConfig(array $mappingConfig, string $mappingName)

Register the mapping driver configuration for later use with the object managers metadata driver chain.

array|false
getMappingDriverBundleConfigDefaults(array $bundleConfig, ReflectionClass $bundle, ContainerBuilder $container)

If this is a bundle controlled mapping all the missing information can be autodetected by this method.

registerMappingDrivers(array $objectManager, ContainerBuilder $container)

Register all the collected mapping information with the object manager by registering the appropriate mapping drivers.

assertValidMappingConfiguration(array $mappingConfig, string $objectManagerName)

Assertion if the specified mapping information is valid.

string|null
detectMetadataDriver(string $dir, ContainerBuilder $container)

Detects what metadata driver to use for the supplied directory.

loadObjectManagerCacheDriver(array $objectManager, ContainerBuilder $container, string $cacheName)

Loads a configured object manager metadata, query or result cache driver.

string
loadCacheDriver(string $cacheName, string $objectManagerName, array $cacheDriver, ContainerBuilder $container)

Loads a cache driver.

array
fixManagersAutoMappings(array $managerConfigs, array $bundles)

Returns a modified version of $managerConfigs.

string
getObjectManagerElementName(string $name)

Prefixes the relative dependency injection container path with the object manager prefix.

string
getMappingObjectDefaultName()

Noun that describes the mapped objects such as Entity or Document.

string
getMappingResourceConfigDirectory()

Relative path from the bundle root to the directory where mapping files reside.

string
getMappingResourceExtension()

Extension used by the mapping files.

Details

in Extension at line 33
string getXsdValidationBasePath()

Returns the base path for the XSD files.

Return Value

string The XSD base path

in Extension at line 41
string getNamespace()

Returns the namespace to be used for this extension (XML namespace).

Return Value

string The XML namespace

in Extension at line 66
string getAlias()

Returns the recommended alias to use in XML.

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.

Return Value

string The alias

Exceptions

BadMethodCallException When the extension name does not follow conventions

in Extension at line 80
ConfigurationInterface|null getConfiguration(array $config, ContainerBuilder $container)

Returns extension configuration.

Parameters

array $config
ContainerBuilder $container

Return Value

ConfigurationInterface|null The configuration or null

in Extension at line 104
final protected processConfiguration(ConfigurationInterface $configuration, array $configs)

Parameters

ConfigurationInterface $configuration
array $configs

in Extension at line 114
final getProcessedConfigs()

in Extension at line 128
protected bool isConfigEnabled(ContainerBuilder $container, array $config)

Parameters

ContainerBuilder $container
array $config

Return Value

bool Whether the configuration is enabled

Exceptions

InvalidArgumentException When the config is not enableable

in Extension at line 30
array getAnnotatedClassesToCompile()

Gets the annotated classes to cache.

Return Value

array An array of classes

in Extension at line 40
addAnnotatedClassesToCompile(array $annotatedClasses)

Adds annotated classes to the class cache.

Parameters

array $annotatedClasses An array of class patterns

at line 43
protected loadMappingInformation(array $objectManager, ContainerBuilder $container)

Parameters

array $objectManager A configured object manager
ContainerBuilder $container A ContainerBuilder instance

Exceptions

InvalidArgumentException

at line 108
protected setMappingDriverAlias(array $mappingConfig, string $mappingName)

Register the alias for this mapping driver.

Aliases can be used in the Query languages of all the Doctrine object managers to simplify writing tasks.

Parameters

array $mappingConfig
string $mappingName

at line 125
protected setMappingDriverConfig(array $mappingConfig, string $mappingName)

Register the mapping driver configuration for later use with the object managers metadata driver chain.

Parameters

array $mappingConfig
string $mappingName

Exceptions

InvalidArgumentException

at line 142
protected array|false getMappingDriverBundleConfigDefaults(array $bundleConfig, ReflectionClass $bundle, ContainerBuilder $container)

If this is a bundle controlled mapping all the missing information can be autodetected by this method.

Returns false when autodetection failed, an array of the completed information otherwise.

Parameters

array $bundleConfig
ReflectionClass $bundle
ContainerBuilder $container

Return Value

array|false

at line 178
protected registerMappingDrivers(array $objectManager, ContainerBuilder $container)

Register all the collected mapping information with the object manager by registering the appropriate mapping drivers.

Parameters

array $objectManager
ContainerBuilder $container A ContainerBuilder instance

at line 233
protected assertValidMappingConfiguration(array $mappingConfig, string $objectManagerName)

Assertion if the specified mapping information is valid.

Parameters

array $mappingConfig
string $objectManagerName

Exceptions

InvalidArgumentException

at line 260
protected string|null detectMetadataDriver(string $dir, ContainerBuilder $container)

Detects what metadata driver to use for the supplied directory.

Parameters

string $dir A directory path
ContainerBuilder $container A ContainerBuilder instance

Return Value

string|null A metadata driver short name, if one can be detected

at line 295
protected loadObjectManagerCacheDriver(array $objectManager, ContainerBuilder $container, string $cacheName)

Loads a configured object manager metadata, query or result cache driver.

Parameters

array $objectManager A configured object manager
ContainerBuilder $container A ContainerBuilder instance
string $cacheName

Exceptions

InvalidArgumentException in case of unknown driver type

at line 312
protected string loadCacheDriver(string $cacheName, string $objectManagerName, array $cacheDriver, ContainerBuilder $container)

Loads a cache driver.

Parameters

string $cacheName The cache driver name
string $objectManagerName The object manager name
array $cacheDriver The cache driver mapping
ContainerBuilder $container The ContainerBuilder instance

Return Value

string

Exceptions

InvalidArgumentException

at line 390
protected array fixManagersAutoMappings(array $managerConfigs, array $bundles)

Returns a modified version of $managerConfigs.

The manager called $autoMappedManager will map all bundles that are not mapped by other managers.

Parameters

array $managerConfigs
array $bundles

Return Value

array The modified version of $managerConfigs

at line 419
abstract protected string getObjectManagerElementName(string $name)

Prefixes the relative dependency injection container path with the object manager prefix.

Parameters

string $name

Return Value

string

at line 428
abstract protected string getMappingObjectDefaultName()

Noun that describes the mapped objects such as Entity or Document.

Will be used for autodetection of persistent objects directory.

Return Value

string

at line 435
abstract protected string getMappingResourceConfigDirectory()

Relative path from the bundle root to the directory where mapping files reside.

Return Value

string

at line 442
abstract protected string getMappingResourceExtension()

Extension used by the mapping files.

Return Value

string