Symfony2 Language for TLD
You're almost there. The only thing you have to do now is inject the parameters into your listener, using "arguments" (arguments for the constructor). %foobar%
refers to the "foobar" parameter, @foobar
refers to the "foobar" service.
parameters: tld_allowed: en,fr,deservices: kernel.listener.domain_langue_listener: class: acme\DemoBundle\Listener\DomainLangueListener arguments: - %tld_allowed% tags: - { name: kernel.event_listener, event: kernel.request, method: onDomainParse }
And the listener:
namespace acme\DemoBundle\Listener;class DomainLangueListener{ public function __construct($tldAllowed) { $this->tldAllowed = $tldAllowed; } ...}