- Where Developers Learn, Share, & Build Careers


I have to pass '_route' from a container as an event listener, along with the route attribute. In other words, I need listener service in which container information needs to be created, the whole service_ container is being overheaded without having to pass in the event listener class.

I have seen a code example like this:

  Services: root.path.locator: class: Acme \ bundle \ HelloBundle \ Util \ RootLocator Arguments: ['kernel .root_dir% ']   

In a controller I will use something like code below to capture "_route":

  $ request = $ This- & gt; Container-> Get ('request'); $ RouteName = $ request- & gt; Get ('_ path');   

However, in the event listener, I am not available.

How can I do the above?

Thank you,

JB

set From the scope to request the service xml tag, it will automatically inject the requested object, then set @request as an argument in Yaml, region: request and set the argument: [@request] .

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -