【问题标题】:Doctrine2 change Tablename FormatDoctrine2 更改表名格式
【发布时间】:2012-02-15 22:08:15
【问题描述】:

我将 ZF2 与 DoctrineModule 和 DoctrineORMModule 一起使用。

问题:我的数据库中有一些表名等于 MYSQL 命令 Doctrine 在没有“`”的 SQL 语句中生成表名

SELECT ... FROM references

但我希望它是这样的格式

SELECT ... FROM `references`

为了安全..

How to Fix it in Doctrine 1 来解决我的问题我已经这样做了: http://i.stack.imgur.com/UN5KB.png

(链接:http://www.doctrine-project.org/documentation/manual/1_0/fr/configuration:naming-convention-attributes:table-name-format

我在 Doctrine2 中没有找到任何解决此问题的方法。 感谢您的帮助。

【问题讨论】:

    标签: php configuration doctrine-orm zend-framework2


    【解决方案1】:

    在 Doctrine2 中没有自动的标识符引用。在这种情况下,您可以直接将引号放入映射中,如下所示:

    @Table(name="`references`")
    

    这应该可以解决问题,但不适用于 2.2 中的模式和 SQLite。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-03-19
      • 1970-01-01
      • 2013-04-05
      • 2020-11-21
      • 2019-04-09
      • 2020-05-05
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多