-
-
Notifications
You must be signed in to change notification settings - Fork 437
Description
make:crud generates a controller which uses ParamConverter to load entities.
Steps to reproduce:
composer create-project symfony/skeleton
composer req twig orm maker form validator server symfony/security-csrfUpdate .env to have some db connectivity:
DATABASE_URL="sqlite:///%kernel.project_dir%/var/app.db"
php bin/console make:entity Foobar // add a name field or something
php bin/console doctrine:schema:create
php bin/console make:crud Foobar
php bin/console server:startNow 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
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.