是否有Symfony2默认容器服务的列表? [英] Is there a list of Symfony2 default container services?
问题描述
以Symfony2网站为例,关于定义自定义服务(YAML符号)的示例:
服务:
newsletter_manager:
class:%newsletter_manager.class%
参数:[@mailer,@templating]
是否有一个默认的Symfony2服务对象列表可以注入到自定义服务中作为参数(如 @邮件员
, @templating
, @doctrine
)?
我知道他们来自 Container
(可以使用,例如每个 Controller
class)。我尝试转储所有服务,但我正在寻找一个更详细的列表:
php应用程序/控制台容器:调试
logger容器Symfony\Bridge\Monolog\Logger
邮件容器Swift_Mailer
翻译器n / a翻译器的别名
...
命令行 此列表仅显示 public 服务。将 编辑:从Symfony 2.7,使用 Here is an example, taken from Symfony2 website, about defining a custom service (YAML notation): Is there a list of default Symfony2 service objects that can be injected into a custom service as parameters (like I know that they come from the
The command line This list shows only public services. Add the option EDIT: From Symfony 2.7, use 这篇关于是否有Symfony2默认容器服务的列表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! php app / console container:debug
显示可以注入到另一个服务中的服务列表,或者通过Controller :: get($ serviceName)从控制器获取。 / p>
- show-private
选项添加到显示私人服务中。私人服务只能注入其他服务,不能从控制器或任何ContainerAware访问...
debug:container
而不是 container:debug
services:
newsletter_manager:
class: %newsletter_manager.class%
arguments: [@mailer, @templating]
@mailer
, @templating
, @doctrine
)?Container
(which is available, for example, in each Controller
class). I've tryed to dump all services, but i'm looking for a more detailed list:php app/console container:debug
logger container Symfony\Bridge\Monolog\Logger
mailer container Swift_Mailer
translator n/a alias for translator.default
...
php app/console container:debug
shows the list of services you can inject into another service or get from a Controller with Controller::get($serviceName)
.--show-private
into display private services. Private services can only be injected in another service, not accessed from a Controller or any ContainerAware...debug:container
instead of container:debug