I ran into a problem while developing with symfony 2.4.
I'm trying to inject request into my service which is a user provider. Everything works fine except there are no route params.
So this is my bundle's routing.yml:
skedl_web_homepage_backend:
pattern: /
host: '{account}.{domain}'
defaults: { _controller: SkedlWebBundle:Backend:index }
requirements:
domain: '%domain%'
My login and registration forms are not far from the onces from the documentation.
Here's my bundle's services.yml:
parameters:
user_provider.class: Skedl\WebBundle\Service\UserProvider
services:
user_provider:
class: "%user_provider.class%"
arguments: [ @doctrine.orm.entity_manager, @request_stack ]
security.yml:
providers:
main:
id: user_provider
And finally a piece from my UserProvider.php:
class UserProvider implements UserProviderInterface
{
protected $em;
public function __construct(\Doctrine\ORM\EntityManager $em, RequestStack $requestStack)
{
$this->em = $em;
var_dump($requestStack->getCurrentRequest());
die;
}
}
I'm trying to get 'account' param from request attributes, but it's totally empty:
["attributes"]=>
object(Symfony\Component\HttpFoundation\ParameterBag)#9 (1) {
["parameters":protected]=>
array(0) {
}
}
["request"]=>
object(Symfony\Component\HttpFoundation\ParameterBag)#7 (1) {
["parameters":protected]=>
array(0) {
}
}
["query"]=>
object(Symfony\Component\HttpFoundation\ParameterBag)#8 (1) {
["parameters":protected]=>
array(0) {
}
}
I set up a request listener and I can get the 'account' param there with no problems. I tried to use scopes but there was no luck (ScopeWideningInjectionException). Am I missing something here?
Thank you.