开发者

PHP Doctrine 1.2 table names

I'm trying to upgrade my doctrine ORM from 1.1.6 to 1.2.1 but i've enounter开发者_Python百科ed 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?


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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜