插入 table 时出现 Symfony EasyAuditBundle 错误
Symfony EasyAuditBundle error when insert into table
我在尝试插入 audit_lo table
时遇到此错误
An exception occurred while executing '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", null,
"::1"]:
和这个日志
Uncaught PHP Exception Doctrine\DBAL\Exception\SyntaxErrorException:
"An exception occurred while executing '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", null,
"::1"]: SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error in or
close to «user» LINE 1: ..._log (id, type_id, type, description,
event_time, user, impe... ^" at
/project/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php
line 70
我遵循 here 和 config.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
交响乐 3.3.X
PostgreSQL 9.6
EasyAuditBundle ^1.4
我分两步回答了这个问题:
- 似乎 postgreSQL 的 USER 列是保留的,所以我在实体
中将其更改为 user_data
- 已将 impersonatingUser 更改为 nullable=true
这对我有用。
我在尝试插入 audit_lo table
时遇到此错误An exception occurred while executing '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", null, "::1"]:
和这个日志
Uncaught PHP Exception Doctrine\DBAL\Exception\SyntaxErrorException: "An exception occurred while executing '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", null, "::1"]: SQLSTATE[42601]: Syntax error: 7 ERROR: syntax error in or close to «user» LINE 1: ..._log (id, type_id, type, description, event_time, user, impe... ^" at /project/vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php line 70
我遵循 here 和 config.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 交响乐 3.3.X PostgreSQL 9.6 EasyAuditBundle ^1.4
我分两步回答了这个问题:
- 似乎 postgreSQL 的 USER 列是保留的,所以我在实体 中将其更改为 user_data
- 已将 impersonatingUser 更改为 nullable=true
这对我有用。