Error “No Metadata Classes to process.” when generating DB tables in Symfony (using Doctrine) created using php app/console doctrine:generate:entity

人走茶凉 提交于 2019-12-12 03:09:23

问题


Symfony newbie here! I installed Symfony and I made a controller and an action and some html is displayed properly. So, Symfony is working fine. I have a problem creating entity tables in the database. I created some entities using (annotations and some other way of making those - I tried couple of different ways of making entities through console, with same result). To create entities I used:

php app/console doctrine:generate:entity

And then, when I try to flush it to the database (in order to create the table(s)), I use this command:

php app/console doctrine:schema:update --force

After running that command, I get this error, and - just as I expected - the tables are not created:

I tried to clear the symfony cache.
I checked AppBundle is registered in AppKernel.
I checked that auto mapping is set to true in entity manager.

What am I missing here? To remind you, I have just installed a fresh Symfony and did the steps I described above. I appreciate your help since I really need this because I want to learn Symfony.


回答1:


I deleted whole bundle, and created bundle through console, and then created tables through console, and this time it worked. I still don't know what was wrong with my previous setting(s) of Symfony.




回答2:


Make sure in your config.yml(app/config.config.yml) you have configured your doctrine->orm->auto_mapping => true.

doctrine:
    dbal:
        ----
        ----
    orm:
        ----
        ----
        auto_mapping: true


来源:https://stackoverflow.com/questions/39257806/error-no-metadata-classes-to-process-when-generating-db-tables-in-symfony-us

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!