Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\RegisterMappingsPass
Base class for the doctrine bundles to provide a compiler pass class that helps to register doctrine mappings.
The compiler pass is meant to register the mappings with the metadata
chain driver corresponding to one of the object managers.
For concrete implementations that are easy to use, see the
RegisterXyMappingsPass classes in the DoctrineBundle resp.
DoctrineMongodbBundle, DoctrineCouchdbBundle and DoctrinePhpcrBundle.
- Author: David Buchmann <david@liip.ch>
Synopsis
class RegisterMappingsPass
implements
CompilerPassInterface
{
- // members
- protected Definition|Reference $driver;
- protected array $namespaces;
- protected array $managerParameters;
- protected string $driverPattern;
- protected string $enabledParameter;
- // methods
- public void __construct()
- public void process()
- protected string getChainDriverServiceName()
- protected Definition|Reference getDriver()
- protected boolean enabled()
Hierarchy
Members
protected
- $driver
—
Symfony\Bridge\Doctrine\DependencyInjection\CompilerPass\Definition|Reference
DI object for the driver to use, either a service definition for a private service or a reference for a public service. - $driverPattern
—
string
Naming pattern of the metadata chain driver service ids, for example 'doctrine.orm.%s_metadata_driver' - $enabledParameter
—
string
A name for a parameter in the container. If set, this compiler pass will only do anything if the parameter is present. (But regardless of the value of that parameter. - $managerParameters
—
array
List of potential container parameters that hold the object manager name to register the mappings with the correct metadata driver, for example array('acme.manager', 'doctrine.default_entity_manager') - $namespaces
—
array
List of namespaces handled by the driver
Methods
protected
- enabled() — Determine whether this mapping should be activated or not. This allows to take this decision with the container builder available.
- getChainDriverServiceName() — Get the service name of the metadata chain driver that the mappings should be registered with. The default implementation loops over the managerParameters and applies the first non-empty parameter it finds to the driverPattern.
- getDriver() — Create the service definition for the metadata driver.
public
- __construct()
- process() — Register mappings with the metadata drivers.