Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot autowire service error #25

Open
seriousTom opened this issue Jun 25, 2019 · 1 comment
Open

Cannot autowire service error #25

seriousTom opened this issue Jun 25, 2019 · 1 comment

Comments

@seriousTom
Copy link

seriousTom commented Jun 25, 2019

Hello, I tried to extend product repository like documented in sylius website I also tried to copy files from this repository, because I see the code differs a bit from the code in documentation. But in any case I get this error 'Cannot autowire service "App\Doctrine\ORM\ProductRepository": argument "$entityManager" of method "Sylius\Bundle\CoreBundle\Doctrine\ORM\ProductRepository::__construct()" references class "Doctrine\ORM\EntityManager" but no such service exists. Try changing the type-hint to one of its parents: interface "Doctrine\ORM\EntityManagerInterface", or interface "Doctrine\Common\Persistence\ObjectManager".'

@stijn-peeters
Copy link

Hi

I had this issue but on further inspection I just forgot to add the repository I created in the yaml file config/packages/_sylius.yaml.
https://docs.sylius.com/en/latest/customization/repository.html

  1. In order to use your repository you need to configure it in the config/packages/_sylius.yaml. As you can see in the _sylius.yaml you already have a basic configuration, now you just need to add your repository and override resourceRepository

(google brought me here)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants