簡體   English   中英

PHP Doctrine 1.2表名

[英]PHP Doctrine 1.2 table names

我正在嘗試將我的理論ORM從1.1.6升級到1.2.1,但是我已經用表名開始了BC問題。

我的一些表名包含幾個單詞(例如,用於FooBar的t_foo_bar),其中t_前綴是使用以下命令自動生成的:

$manager->setAttribute(Doctrine_Core::ATTR_TBLNAME_FORMAT, 't_%s');

這在以前的版本中效果很好。 但是在1.2.1中,主義似乎正在尋找t_foobar(而不是帶下划線的t_foo_bar)。

您知道如何在不更改表名稱的情況下解決此問題嗎?

在模型的setTableDefinition()方法中,可以調用$this->setTableName('t_foo_bar')來顯式設置表名。 這樣好得多,就好像某個類被重命名了一樣,該應用程序將繼續運行。

哦,我通過Google到了這里。 我剛剛開始使用symfony,並想將symfony + doctrine應用程序添加到現有的Web應用程序中。

我已經在《 Doctrine》文檔中找到了這些東西(注意第二行):


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

似乎您也可以在yml文件中定義表名稱。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM