[英]Symfony 2: Doctrine Cache Namespace
doctrine:
orm:
metadata_cache_driver:
type: xcache
namespace: %foobar%
hi, i want set the doctrine cache namespace via parameter like %foobar%. 嗨,我想通过%foobar%之类的参数设置学说缓存名称空间。 the parameter %foobar% will set via compilerPass
参数%foobar%将通过editorPass设置
class FoobarCompiler implements CompilerPassInterface {
public function process(ContainerBuilder $container) {
$container->setParameter('foobar', uniqid());
}
}
and this compilerPass ist register in a bundle class via: 并通过以下方式将此bundled编译器注册到捆绑类中:
public function build(\Symfony\Component\DependencyInjection\ContainerBuilder $container) {
$container->addCompilerPass(new \FQNS\Compiler\FoobarCompiler());
}
but i get this error: 但我得到这个错误:
[Symfony\\Component\\DependencyInjection\\Exception\\ParameterNotFoundException] You have requested a non-existent parameter "foobar".
[Symfony \\ Component \\ DependencyInjection \\ Exception \\ ParameterNotFoundException]您已请求一个不存在的参数“ foobar”。
any idea how can i set the doctrine cache namespace via this parameter "foobar" ? 知道如何通过此参数“ foobar”设置主义缓存名称空间吗?
greez & thx, sky... greez&thx,天空...
the answer is this snippet: 答案是以下代码段:
class FoobarExtension extends Extension implements PrependExtensionInterface {
...
public function prepend(ContainerBuilder $container) {
$container->setParameter('foobar', uniqid());
}
}
it is importand to add the "PrependExtensionInterface" interface ! 导入并添加“ PrependExtensionInterface”接口!
greez & thx, sky... greez&thx,天空...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.