Answer the question
In order to leave comments, you need to log in
Why can't I inject a repository as a service in symfony3?
Hello. Please help me figure out why it is not possible to inject the repository into the service as a dependency? I am using symfony3. In symfony2.8 this worked...
app.repository.product:
class: AppBundle\Repository\ProductRepository
factory_service: doctrine.orm.entity_manager
factory_method: getRepository
arguments: ["AppBundle:Product"]
app.controller.product:
class: AppBundle\Controller\ProductController
arguments: ["@form.factory", "@app.repository.product"]
Catchable Fatal Error: Argument 2 passed to Doctrine\ORM\EntityRepository::__construct() must be an instance of Doctrine\ORM\Mapping\ClassMetadata, none given....
app.repository.product:
class: AppBundle\Repository\ProductRepository
factory: ["@doctrine.orm.default_entity_manager", getRepository]
arguments: [AppBundle\Entity\Product]
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question