I know that I can access registered services by using the dot notation in a Twig template (example app.request.host
). However, if I've created my own namespaced service (in this case tagframe.photoservice
), when I try to access it, I am given an error that the method "tagframe" doesn't exist on the object "Silex\Application". Is it possible to access services that have been dot namespaced? In other words, a service that I would normally access using $app['tagframe.photoservice'] in the controller?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Yes, just like accessing array:
{{ app["tagframe.photoservice"].resizePhoto() }}