【问题标题】:Symfony EasyAuditBundle error when insert into table插入表时 Symfony EasyAuditBundle 错误
【发布时间】:2017-11-22 15:05:02
【问题描述】:

当它尝试插入 audit_lo 表时出现此错误

执行 'INSERT INTO audit_log (id, type_id, type, description, event_time, user, impersonatingUser, ip) VALUES (?, ?, ?, ?, ?, ?, ?, ?)' with params [5, “security.interactive_login”,“security.interactive_login”, “security.interactive_login”,“2017-11-22 12:56:48”,“bmellor”,空, "::1"]:

还有这个日志

未捕获的 PHP 异常 Doctrine\DBAL\Exception\SyntaxErrorException: “执行 'INSERT INTO audit_log (id, type_id, type, description, event_time, user, impersonatingUser, ip) VALUES (?, ?, ?, ?, ?, ?, ?, ?)' with params [5, “security.interactive_login”,“security.interactive_login”, “security.interactive_login”,“2017-11-22 12:56:48”,“bmellor”,空, "::1"]: SQLSTATE[42601]: 语法错误: 7 错误: or 中的语法错误 接近 «user» LINE 1: ..._log (id, type_id, type, description, event_time, 用户, impe ... ^" at /project/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php 第 70 行

我遵循hereconfig.yml 中的所有步骤

xiidea_easy_audit:
    entity_class : AppBundle\Entity\AuditLog                     #Required
    user_property : username                            #Optional
    doctrine_entities :                                              #Optional
         AppBundle\Entity\SomeEntity : [created, updated, deleted]
    events :                                                   #Optional
        - security.interactive_login

编辑

环境 PHP 7.1.11 Symfony 3.3.X PostgreSQL 9.6 EasyAuditBundle ^1.4

【问题讨论】:

    标签: symfony doctrine-orm audit


    【解决方案1】:

    我用 2 个步骤回答了这个问题:

    1. 似乎 postgreSQL 中的 USER 列是保留的,所以我将其更改为实体内的 user_data
    2. 将 impersonatingUser 更改为 nullable=true

    这对我有用。

    【讨论】:

      猜你喜欢
      • 2011-11-25
      • 1970-01-01
      • 2012-11-26
      • 1970-01-01
      • 2011-10-04
      • 1970-01-01
      • 2013-02-22
      • 1970-01-01
      • 2017-04-28
      相关资源
      最近更新 更多