Reputation: 1855
I'm trying to upgrade my doctrine ORM from 1.1.6 to 1.2.1 but i've enountered a BC issue with table names.
Some of my table names have several words (e.g. t_foo_bar for class FooBar) where the t_ prefix is generated automatically with:
$manager->setAttribute(Doctrine_Core::ATTR_TBLNAME_FORMAT, 't_%s');
This worked well in previous versions. In 1.2.1 however, it looks like doctrine is looking for t_foobar (instead of t_foo_bar with an underscore).
Do you know how to solve this without changing the table names?
Upvotes: 0
Views: 2604
Reputation: 1082
Oh, I've got here through google. I've just started symfony and want to add symfony+doctrine app to an existing web-app.
I've found this stuff in the Doctrine docs (notice second line):
Group:
**tableName: group_table**
columns:
id:
type: integer(4)
autoincrement: true
primary: true
name:
type: string(255)
relations:
Users:
foreignAlias: Groups
class: User
refClass: GroupUser
Seems you can define table name in the yml file too.
Upvotes: 1
Reputation: 37633
In the setTableDefinition()
method of your model you can call $this->setTableName('t_foo_bar')
to set the table name explicitly. This is much better, as if some class gets renamed, the app will continue to work.
Upvotes: 2