Reputation: 297
Good Day,
I'm having few issues with Doctrine entities generator while creating new project in Symfony 2 framework.
For testing purposes, I have following table called users: id INT PK
username VARCHAR(80)
password VARCHAR(150)
salt VARCHAR(100)
email VARCHAR(100)
I created new project with no problem. I called my new bundle MyTestBundle.
After completing database design, I use php app/console doctrine:mapping:convert yml ./src/My/TestBundle/Resources/config/doctrine/metadata/orm --from-database --force
to map database schema to Yaml format files. Then I use php app/console doctrine:mapping:import MyTestBundle annotation
and php app/console doctrine:generate:entities MyTestBundle
to import mapping and generate entities.
I have few important questions regarding entities generation:
Why does it creates entity called Users instead of User? When I try to modify yml files located in ./src/My/TestBundle/Resources/config/doctrine/metadata/orm
the generator seems to ignore them. Any tips?
I need to implement my custom role provider. That's why I created two additional tables for roles storage (simplified schema below):
roles: id INT PK, name VARCHAR(50)
users_roles: id INT PK, user_id INT, role_id INT
Why generator is ignoring this relation? It creates correct relations in UsersRoles class, but not in Roles or Users entities. Am I missing something?
Any help/explanation will be very appreciated.
Edit
I have noticed really weird thing:
I created simple Yaml schema and put it in ./src/MyTestBundle/resources/config/doctrine/metadata/orm
, I called this file User.orm.yml
. Now, when I try to import mapping or generate entities I get following error Bundle "MyTestBundle" does not contain any mapped entities.
Warmest greetings,
Dave
Upvotes: 5
Views: 3968
Reputation: 297
This question was replied on Symfony 2 Group: http://groups.google.com/group/symfony2/browse_thread/thread/fa088382e6546679/50ab1902a573feb6?lnk=gst&q=entity+generation#50ab1902a573feb6
Upvotes: 1