user2733521
user2733521

Reputation: 449

Symfony3 : Generate crud doesn't work

I'm trying to use the generate crud feature with my new symfony3 project. I have created a bundle named AdminBundle with the generator, the entity test, also with the generator, all processed well to the end. I checked my file under, i have my class Test.php generated under my src/AdminBundle/Entity/Test.php folder. All is working well.

But when i try to generate a crud following the doc for my test entity with the following command :

bin/console generate:doctrine:crud
The Entity shortcut name: AdminBundle:Test

I get the following error :

[RuntimeException] Entity "Test" does not exist in the "AdminBundle" bundle. You may have mistyped the bundle name or maybe the entity doesn't exist yet (create it first with the "doctrine:generate:entity" comm and).

As i said, i already generated the entity with the "doctrine:generate:entity" command, and i type the same name ( AdminBundle:Test ) as i type in my crud generator.

Any ideas ?

Upvotes: 3

Views: 1784

Answers (4)

Sadi
Sadi

Reputation: 2416

It's an old issue. But I face it too, just now. I solved it by pointing the class with whole name space.

$test = new \AppBundle\Entity\Test();

Upvotes: 0

Adam
Adam

Reputation: 3518

I had to do bin/console doctrine:schema:update for it to acknowledge the entity as I had the class but the entity was not in the DB yet.

Upvotes: 0

marcelo6297
marcelo6297

Reputation: 41

I have the same problem with sf2.8.

What I did to solve this problem was:

first: generate the form for the entity. php app/console doctrine:generate:form NameBundle:EntityName

Second: generate the CRUD for Entity php app/console doctrine:generate:crud

Upvotes: 2

vince-db
vince-db

Reputation: 31

I just ran into this problem. One of my entity's attributes annotations were mistyped, causing this error. Check your attributes annotations.

Upvotes: 0

Related Questions