教义问题:构建模式

时间:2010-03-19 17:38:01

标签: php symfony1 doctrine

我正在使用symfony和doctrine,我试图从db生成架构yml文件。我收到了这个错误

     SQLSTATE[42000]: Syntax error or access violation: 1064 You have an error in your SQL syntax; check the manual that corresponds to
your MySQL server version for the right syntax to use near 'group' at line 1. Failing Query: "DESCRIBE group"I have a table named group in my database, and I suspect that this is screwing it up. 

它没有访问问题,因为我检查了我的数据库优先级。关于我能做什么的任何建议?我试过了quote-identifier属性,但没有运气:(

我也在努力寻找一些好的学说文档。我似乎无法找到属性列表的位置,比如在schema.yml文件中创建一个列。我试图联系symfony论坛,但他们没有回应!任何帮助将不胜感激!感谢..

2 个答案:

答案 0 :(得分:3)

如上所述,group是MySQL中的保留关键字,因此您需要转义其名称。在项目配置类(/config/ProjectConfiguration.class.php)中,将Doctrine Manager配置为使用引号:

class ProjectConfiguration extends sfProjectConfiguration {
    public function setup() {
        //...
    }

    public function configureDoctrine(Doctrine_Manager $manager) {
        $manager->setAttribute(Doctrine_Core::ATTR_QUOTE_IDENTIFIER, true);
    }
}

答案 1 :(得分:1)

假设您使用的是最新的MySQL,“group”是一个保留字:

http://dev.mysql.com/doc/refman/5.5/en/reserved-words.html

相关问题