我写了一个小树枝扩展,它提供了一些功能。
这个扩展是捆绑的,我想将它作为捆绑的服务公开,所以我创建了 services.yml:
services:
twig.job_action_extension:
class: WebBundle\Template\JobActionExtension
arguments: ["@translator"]
tags:
- { name: twig.extension }
但似乎扩展从未暴露。
运行php app/console container:debug
没有列出我的服务。
是否可以像这里一样将树枝扩展注册为服务?或者如果我想将它作为我的包的一部分贡献出来,我是否需要像这里
一样在 DependencyInjection 下创建一个扩展?