将其他配置注入自定义实体/文档管理器 [英] Inject additional configuration into custom Entity/Document Manager

查看:83
本文介绍了将其他配置注入自定义实体/文档管理器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我为我的项目制作了一个自定义文档管理器,实现了一些新的底层功能(此帖子之后)。

I made a custom Document Manager for my project implementing some new low level functions (following this post).

现在,我想在新的文档管理器中注入自定义配置(我想与实体管理器相同)。我不知道该怎么做...

Now I would like to inject a custom configuration in my new Document Manager (I suppose it would be the same with an Entity Manager). I have no idea of how to do this...

我希望yaml文件中的此配置可以设置自定义文档管理器的参数。到目前为止,我发现的唯一方法是编写一个返回硬编码配置数组的静态函数,但这有点脏...)

I want this config in my yaml files to set my custom Document Manager's parameters. The only way I found until now is to write a static function returning a hardcoded array of configuration, but it's a little dirty...)

是否有正确的方法或

推荐答案

要在 conig.yml 文件中定义自定义配置,请使用此symfony文档。您可以在控制器中轻松访问这些配置:

For defining custom configuration in the conig.yml file, use this symfony docs. You can access those configurations easily in a controller:

$this->container->getParameter(name_of_bundle_here)

这篇关于将其他配置注入自定义实体/文档管理器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆