The configuration uses :
doctrine:
dbal:
driver: "%database_driver%"
....
orm:
auto_generate_proxy_classes: "%kernel.debug%"
auto_mapping: true
What is the exact meaning of auto_mapping
? It is used in tons of examples with true and false, and no precise description.
When does occurs the proxy generation if it's not auto ? By doctrine command-line tools ?
auto_mapping
is where doctrine will automatically load the mapping from your bundle Resources/config/doctrine
directory.
Setting it to false will mean that you will need to load the mappings yourself. It can be handy if you have mappings for entities rather than mapped superclasses in a vendor bundle that you want to override.
You can do this either by way of stating the mappings in the doctrine config ...
doctrine:
orm:
entity_managers:
default:
mappings:
AcmeUnknownBundle:
mapping: true
type: yml
dir: "Resources/config/doctrine"
alias: ~
prefix: Acme\UnknownBundle\Entity
is_bundle: true
adding them in some sort of mappings pass ...
class AcmeUnknownBundle extends Bundle
{
public function build(ContainerBuilder $container)
{
parent::build($container);
// ...
$modelDir = realpath(__DIR__.'/Resources/config/doctrine/model');
$mappings = array(
$modelDir => 'Acme\UnknownBundle\Model',
);
$ormCompilerClass = 'Doctrine\Bundle\DoctrineBundle\DependencyInjection\Compiler\DoctrineOrmMappingsPass';
if (class_exists($ormCompilerClass)) {
$container->addCompilerPass(
DoctrineOrmMappingsPass::createYamlMappingDriver(
$mappings,
array('acme_unknown.model_manager_name'),
true
));
}
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With