Reputation: 199
I have actually finished a project using Symfony2, but my boss want that I change names of tables in the database. He wants to put underscore in the name of my tables, that means underscore in class names.
I tried to do this but it doesn't work. When I do that, I got an error that says: "The entity "entity" cannot be found in "another entity"".
I also try to rename class names without underscore to see if I was doing a mistake but no, that's working.
I search on the web and see maybe a reason who can explain that issue, here it is:
So someone can tell me exactly how can I do to put underscore in my tables names with symfony?
Upvotes: 0
Views: 2179
Reputation: 8915
There is maybe a better solution: use the underscore naming strategy.
https://stackoverflow.com/a/12702949/244058
Upvotes: 1
Reputation: 1333
According to the doc you can separate your table name from your class name.
Just do this :
<?php
/**
* @Entity
* @Table(name="my_table_name")
*/
class MyPersistentClass
{
//...
}
and that's all :)
I have to add that if you re-generate your data model with the app/console doctrine:schema:update --force
command you won't destroy existing tables and data. Then you'll have to migrate data by hand from old tables to new ones.
Upvotes: 1