php - Symfony 在调试 :container --show-private 中不显示私有(private)服务

标签 php symfony

运行

app/console debug:container --show-private 

不列出使用 public: false 声明的服务,例如:

 another_service:
        public: false
        class: MineBundle\Service\FirstService

但是,如果我运行 app/console debug:container --show-private | wc -lapp/console debug:container | wc -l 我会得到不同的结果。

尝试使用 symfony 2.8 和 3.1 并得到相同的行为。

有什么想法吗?

谢谢!

最佳答案

Sorry, it's in the doc :)

If a private service is only used as an argument to just one other service, it won't be displayed by the debug:container command, even when using the --show-private option. See Inline Private Services for more details.

然后

What makes private services special is that, if they are only injected once, they are converted from services to inlined instantiations (e.g. new PrivateThing()). This increases the container's performance.

关于php - Symfony 在调试 :container --show-private 中不显示私有(private)服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38005407/

相关文章:

php - 在使用ajax将其发送到服务器之前如何检查表单中的值

php - 在 css 中使用 php 来定位一个唯一的对象类

PHP - 存储为 BLOB 的图像显示为断开的链接

forms - 使用自引用实体的 Symfony 表单渲染

symfony - 使用路径链接表单标签

css - symfony2 assetic css/sass : get Internal Server Error only in dev . css 文件

jquery - FOSJsRoutingBundle : Cannot Generate routing url inside javascript

php - 如何从表格中的每个不同类别中选择三行?

php - 改进 SQL 查询

validation - 在 pre_set_data 中添加的 Symfony2 非映射字段不存在于表单的子集合中