I want to get Current locale in my Repository.That's why I am injecting the Container into my Repository but I am getting error that I am unable to figure it out.
This is my service.yml
code
survey.repository.container_aware:
class: Demo\SurveyBundle\Repository\SurveyRepository
calls:
- [ setContainer, [ @service_container ] ]
and this is my repository class code
.......
use Symfony\Component\DependencyInjection\ContainerInterface as Container;
.......
protected $container;
public function __construct(Container $container) {
$this->container = $container;
}
After that I am getting below error
ContextErrorException: Catchable Fatal Error: Argument 1 passed to
Demo\SurveyBundle\Entity\SurveyRepository::__construct() must implement
interface Symfony\Component\DependencyInjection\ContainerInterface, instance of
Doctrine\ORM\EntityManager given
What I am missing in my construct or in service?