<?php
namespace App\Entity;
use App\Entity\Traits\Timestampable;
use App\Repository\ParentActivationHistoryRepository;
use Doctrine\ORM\Mapping as ORM;
/**
* Historique des activations/désactivations de comptes parents
* (fonctionnalité super-admin — voir ParentActivationService). Une ligne par
* action, jamais modifiée après coup (contrairement à ScolarityHistory, il
* n'y a pas de notion de "correction" ici).
*/
#[ORM\Entity(repositoryClass: ParentActivationHistoryRepository::class)]
#[ORM\HasLifecycleCallbacks]
class ParentActivationHistory
{
use Timestampable;
public const ACTION_ACTIVATED = 'activated';
public const ACTION_DEACTIVATED = 'deactivated';
#[ORM\Id]
#[ORM\GeneratedValue]
#[ORM\Column]
private ?int $id = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?User $parent = null;
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?School $school = null;
// Qui a effectué l'action : le super-admin, ou un titulaire de
// ROLE_ACTIVATION_VIEWER habilité (canManageActivation = true).
#[ORM\ManyToOne]
#[ORM\JoinColumn(nullable: false)]
private ?User $author = null;
#[ORM\Column(length: 20)]
private ?string $action = null;
public function getId(): ?int
{
return $this->id;
}
public function getParent(): ?User
{
return $this->parent;
}
public function setParent(?User $parent): static
{
$this->parent = $parent;
return $this;
}
public function getSchool(): ?School
{
return $this->school;
}
public function setSchool(?School $school): static
{
$this->school = $school;
return $this;
}
public function getAuthor(): ?User
{
return $this->author;
}
public function setAuthor(?User $author): static
{
$this->author = $author;
return $this;
}
public function getAction(): ?string
{
return $this->action;
}
public function setAction(string $action): static
{
$this->action = $action;
return $this;
}
}