symfony2 propel-bundle + postgres:“。”附近的语法错误

时间:2014-03-01 20:09:11

标签: postgresql symfony propel

这是我的登录表单,它使用propel作为用户提供程序,我收到此错误,我可以理解,标识符没有引用:

和错误:

Unable to execute SELECT statement [SELECT user.id, user.username, user.password, user.email, user.type, user.first_name, user.last_name, user.national_code, user.personal_code, user.role, user.card, user.university_id, user.salt, user.active, user.created_at, user.updated_at FROM user WHERE user.username=:p1 LIMIT 1] [wrapped: SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error at or near "." LINE 1: SELECT user.id, user.username, user.password, user.email, us... ^]

我的推进配置:

propel:
    path:           "%kernel.root_dir%/../vendor/propel"
    phing_path:     "%kernel.root_dir%/../vendor/phing"
    logging:        %kernel.debug%
    dbal:
        default_connection: default
        connections:
            default:
                driver:     %database_driver%
                user:        %database_user%
                password:   %database_password%
                dsn:        %database_driver%:host=%database_host%;dbname=%database_name%
                options:
                    ATTR_PERSISTENT: false
                attributes:
                    ATTR_EMULATE_PREPARES: true
                settings:
                    charset: { value: UTF8 }
    build_properties:
        propel.database: %database_driver%
        propel.database.url: ${propel.dsn}
        propel.database.buildUrl: ${propel.database.url}
        propel.database.createUrl: ${propel.database.buildUrl}
        propel.database.user: %database_user%
        propel.database.password: %database_password%
        propel.platform.class: platform.${propel.database}Platform
        propel.disableIdentifierQuoting: false

以及我的提供商配置:

providers:
    main:
        propel:
            class:             National\PublicationBundle\Model\User
            property:          username

我的配置有问题吗?我还在github上找到this并相应地更改了我的代码,但它确实没有改变,我做了什么:

\$sql = sprintf(
'$query',
    implode(', ', array_map(function(\$e) { return '\"'.\$e.'\"' ; }, \$modifiedColumns)),
    implode(', ', array_keys(\$modifiedColumns))

);

还有一件事:当我生成sql wih php app / console propel:build:sql时,sql代码被正确引用。

1 个答案:

答案 0 :(得分:0)

回答:用户是保留字!所以只是将其改为用户并解决了! :\