Cannot autowire argument $foobar of "App\Controller\FoobarController::show()": it references class "App\Entity\Foobar" but no such service exists.
Entities are not supposed to be autowired, in this case they should be loaded by ParamConverter.
Fix this by installing the bundle containing the paramconverter:
composer require sensio/framework-extra-bundle
Note that I started with symfony/skeletoninstead of symfony/website-skeleton, which includes the framework-extra-bundle. However the dependency should be included in MakeCrud::configureDependencies.
make:crud generates a controller which uses ParamConverter to load entities.
Steps to reproduce:
Update .env to have some db connectivity:
DATABASE_URL="sqlite:///%kernel.project_dir%/var/app.db"
Now open the webserver and browse to the route, probably http://127.0.0.1:8000/foobar/new Add an entity Click on the entity show or edit link, probably http://127.0.0.1:8000/foobar/1
Entities are not supposed to be autowired, in this case they should be loaded by ParamConverter.
Fix this by installing the bundle containing the paramconverter:
composer require sensio/framework-extra-bundle
Note that I started with
symfony/skeleton
instead ofsymfony/website-skeleton
, which includes the framework-extra-bundle. However the dependency should be included inMakeCrud::configureDependencies
.