Php Symfony在debug:container--show private中不显示私有服务
运行Php Symfony在debug:container--show private中不显示私有服务,php,symfony,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-l和app/console debug:container |
app/console debug:container --show-private
未列出使用public:false声明的服务,例如:
another_service:
public: false
class: MineBundle\Service\FirstService
但是,如果我运行app/console debug:container--show private | wc-l
和app/console debug:container | wc-l
我将得到不同的结果
尝试使用symfony 2.8和3.1,得到了相同的行为
有什么想法吗
谢谢
如果一个私有服务仅用作另一个的参数
服务,它甚至不会由debug:container命令显示
使用--show private选项时。有关详细信息,请参阅内联专用服务
更多细节
然后
私人服务的特殊之处在于,如果它们只是注入
一旦它们从服务转换为内联实例化(例如。
新私密物品()。这将提高容器的性能
非常明显,但是您是否确保您的服务文件正在加载,并且已清除缓存?是的,现在更有意义了。我想我太执着于认为这只是一个可见性控制的东西,而实际上是为了优化容器。:)