merged branch Tatsh/di-cache-namespace (PR #8639)
This PR was squashed before being merged into the master branch (closes #8639).
Discussion
----------
[DoctrineBridge] [ORM] Use custom cache namespace option if it is specified
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
This allows an option `namespace` to be used instead of having Symfony generate the hash. If the option is not set, the original behaviour will occur.
While this code will execute on the current version, this change depends on https://github.com/doctrine/DoctrineBundle/pull/198 to fully work.
Commits
-------
e6687d9
[DoctrineBridge] [ORM] Use custom cache namespace option if it is specified
This commit is contained in:
commit
3248c1b3e0
@ -365,9 +365,13 @@ abstract class AbstractDoctrineExtension extends Extension
|
||||
}
|
||||
|
||||
$cacheDef->setPublic(false);
|
||||
// generate a unique namespace for the given application
|
||||
$namespace = 'sf2'.$this->getMappingResourceExtension().'_'.$objectManager['name'].'_'.md5($container->getParameter('kernel.root_dir').$container->getParameter('kernel.environment'));
|
||||
$cacheDef->addMethodCall('setNamespace', array($namespace));
|
||||
|
||||
if (!isset($cacheDriver['namespace'])) {
|
||||
// generate a unique namespace for the given application
|
||||
$cacheDriver['namespace'] = 'sf2'.$this->getMappingResourceExtension().'_'.$objectManager['name'].'_'.md5($container->getParameter('kernel.root_dir').$container->getParameter('kernel.environment'));
|
||||
}
|
||||
|
||||
$cacheDef->addMethodCall('setNamespace', array($cacheDriver['namespace']));
|
||||
|
||||
$container->setDefinition($cacheDriverService, $cacheDef);
|
||||
}
|
||||
|
Reference in New Issue
Block a user