Closed braianj closed 6 years ago
Could you please provide some more information. Like: Symfony version Php version EasyAuditBundle version
Best, if you can provide an example project to reproduce the bug.
Hi @ronisaha, here goes some info:
And the code is the same as the examples
Could you also share the entity class. Another question, are you using fos user bundle? If yes which version?
Also comment that i'm using postgreSQL 9.6
This is my entity
<?php
namespace AppBundle\Entity;
use Doctrine\ORM\Mapping as ORM;
use Xiidea\EasyAuditBundle\Entity\BaseAuditLog;
/**
* @ORM\Entity
* @ORM\Table(name="audit_log")
*/
class AuditLog extends BaseAuditLog
{
/**
* @ORM\Id
* @ORM\Column(type="integer")
* @ORM\GeneratedValue(strategy="AUTO")
*/
protected $id;
/**
* Type Of Event(Internal Type ID)
*
* @var string
* @ORM\Column(name="type_id", type="string", length=200, nullable=false)
*/
protected $typeId;
/**
* Type Of Event
*
* @var string
* @ORM\Column(name="type", type="string", length=200, nullable=true)
*/
protected $type;
/**
* @var string
* @ORM\Column(name="description", type="string", length=255, nullable=true)
*/
protected $description;
/**
* Time Of Event
* @var \DateTime
* @ORM\Column(name="event_time", type="datetime")
*/
protected $eventTime;
/**
* @var string
* @ORM\Column(name="user", type="string", length=255)
*/
protected $user;
/**
* @var string
* @ORM\Column(name="impersonatingUser", type="string", length=255)
*/
protected $impersonatingUser;
/**
* @var string
* @ORM\Column(name="ip", type="string", length=20, nullable=true)
*/
protected $ip;
}
And in order to make it work I need it to change the column user for user_name (it seems like user is a reserved name) and to set impersonatingUser as nullable=true, if not this throw me an error.
@braianj Yup, user
is a reserved keyword in Postgresql: https://www.postgresql.org/docs/9.6/static/sql-keywords-appendix.html
Same issue for impersonatingUser
, i had to make it nullable
in order to work properly.
Can someone explain me what is the goal and how works this property ?
Of course you need to make nullable the impersonatingUser
property as it is an optional property. impersonatingUser
is used when you enable impersonatingUser feature. The field will hold the original user value.
Okay thank you, it sounds obvious
I got this error when it try to insert into the 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"]:
and this log