Some checks failed
Auto Tag Develop / tag (push) Has been cancelled
| Numéro du ticket | Titre du ticket | |------------------|-----------------| | | | ## Description de la PR ## Modification du .env ## Check list - [ ] Pas de régression - [ ] TU/TI/TF rédigée - [ ] TU/TI/TF OK - [ ] CHANGELOG modifié Reviewed-on: #9 Co-authored-by: tristan <tristan@yuno.malio.fr> Co-committed-by: tristan <tristan@yuno.malio.fr>
170 lines
3.6 KiB
PHP
170 lines
3.6 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Entity;
|
|
|
|
use App\Repository\AuditLogRepository;
|
|
use DateTimeImmutable;
|
|
use Doctrine\ORM\Mapping as ORM;
|
|
|
|
#[ORM\Entity(repositoryClass: AuditLogRepository::class)]
|
|
#[ORM\Table(name: 'audit_logs')]
|
|
#[ORM\Index(name: 'idx_audit_employee_created', columns: ['employee_id', 'created_at'])]
|
|
#[ORM\Index(name: 'idx_audit_entity', columns: ['entity_type', 'entity_id'])]
|
|
#[ORM\Index(name: 'idx_audit_created', columns: ['created_at'])]
|
|
#[ORM\Index(name: 'idx_audit_affected_date', columns: ['affected_date'])]
|
|
class AuditLog
|
|
{
|
|
#[ORM\Id]
|
|
#[ORM\GeneratedValue]
|
|
#[ORM\Column(type: 'integer')]
|
|
private ?int $id = null;
|
|
|
|
#[ORM\ManyToOne(targetEntity: Employee::class)]
|
|
#[ORM\JoinColumn(nullable: true, onDelete: 'SET NULL')]
|
|
private ?Employee $employee = null;
|
|
|
|
#[ORM\Column(type: 'string', length: 180)]
|
|
private string $username = '';
|
|
|
|
#[ORM\Column(type: 'string', length: 30)]
|
|
private string $action = '';
|
|
|
|
#[ORM\Column(type: 'string', length: 50)]
|
|
private string $entityType = '';
|
|
|
|
#[ORM\Column(type: 'integer', nullable: true)]
|
|
private ?int $entityId = null;
|
|
|
|
#[ORM\Column(type: 'text')]
|
|
private string $description = '';
|
|
|
|
#[ORM\Column(type: 'json', nullable: true)]
|
|
private ?array $changes = null;
|
|
|
|
#[ORM\Column(type: 'date_immutable', nullable: true)]
|
|
private ?DateTimeImmutable $affectedDate = null;
|
|
|
|
#[ORM\Column(type: 'datetime_immutable')]
|
|
private DateTimeImmutable $createdAt;
|
|
|
|
public function __construct()
|
|
{
|
|
$this->createdAt = new DateTimeImmutable();
|
|
}
|
|
|
|
public function getId(): ?int
|
|
{
|
|
return $this->id;
|
|
}
|
|
|
|
public function getEmployee(): ?Employee
|
|
{
|
|
return $this->employee;
|
|
}
|
|
|
|
public function setEmployee(?Employee $employee): self
|
|
{
|
|
$this->employee = $employee;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getUsername(): string
|
|
{
|
|
return $this->username;
|
|
}
|
|
|
|
public function setUsername(string $username): self
|
|
{
|
|
$this->username = $username;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getAction(): string
|
|
{
|
|
return $this->action;
|
|
}
|
|
|
|
public function setAction(string $action): self
|
|
{
|
|
$this->action = $action;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getEntityType(): string
|
|
{
|
|
return $this->entityType;
|
|
}
|
|
|
|
public function setEntityType(string $entityType): self
|
|
{
|
|
$this->entityType = $entityType;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getEntityId(): ?int
|
|
{
|
|
return $this->entityId;
|
|
}
|
|
|
|
public function setEntityId(?int $entityId): self
|
|
{
|
|
$this->entityId = $entityId;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getDescription(): string
|
|
{
|
|
return $this->description;
|
|
}
|
|
|
|
public function setDescription(string $description): self
|
|
{
|
|
$this->description = $description;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getChanges(): ?array
|
|
{
|
|
return $this->changes;
|
|
}
|
|
|
|
public function setChanges(?array $changes): self
|
|
{
|
|
$this->changes = $changes;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getAffectedDate(): ?DateTimeImmutable
|
|
{
|
|
return $this->affectedDate;
|
|
}
|
|
|
|
public function setAffectedDate(?DateTimeImmutable $affectedDate): self
|
|
{
|
|
$this->affectedDate = $affectedDate;
|
|
|
|
return $this;
|
|
}
|
|
|
|
public function getCreatedAt(): DateTimeImmutable
|
|
{
|
|
return $this->createdAt;
|
|
}
|
|
|
|
public function setCreatedAt(DateTimeImmutable $createdAt): self
|
|
{
|
|
$this->createdAt = $createdAt;
|
|
|
|
return $this;
|
|
}
|
|
}
|