<?phpdeclare(strict_types=1);namespace App\Entity;use App\Repository\AccountDeletionLogRepository;use Doctrine\ORM\Mapping as ORM;use Gedmo\Mapping\Annotation as Gedmo;/** * Trace d'une suppression de compte (RGPD), sans aucune donnée personnelle. * * Volontairement sans clé étrangère vers user : la trace doit survivre à tout * nettoyage du compte. subjectHash = HMAC-SHA256 de l'id utilisateur avec APP_SECRET, * pour pouvoir répondre « ce compte a-t-il été supprimé ? » sans stocker l'id en clair. * * @ORM\Entity(repositoryClass=AccountDeletionLogRepository::class) * @ORM\Table(name="account_deletion_log", indexes={ * @ORM\Index(name="idx_account_deletion_log_subject", columns={"subject_hash"}) * }) */class AccountDeletionLog{ public const CHANNEL_WEB = 'web'; public const CHANNEL_APP = 'app'; /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private ?int $id = null; /** * HMAC-SHA256 (hex) de l'id utilisateur * * @ORM\Column(type="string", length=64) */ private string $subjectHash; /** * Catégorie du compte supprimé (client…) * * @ORM\Column(type="string", length=50) */ private string $category; /** * Canal de la demande : web ou app * * @ORM\Column(type="string", length=10) */ private string $channel; /** * Nombre de lignes supprimées ou anonymisées par table (jamais de valeur) * * @ORM\Column(type="json") */ private array $summary = []; /** * Date de la suppression * * @ORM\Column(type="datetime_immutable") * @Gedmo\Timestampable(on="create") */ private ?\DateTimeImmutable $createdAt = null; /** * @ORM\Column(type="datetime_immutable") * @Gedmo\Timestampable */ private ?\DateTimeImmutable $updatedAt = null; public function __construct(string $subjectHash, string $category, string $channel) { $this->subjectHash = $subjectHash; $this->category = $category; $this->channel = $channel; } public function getId(): ?int { return $this->id; } public function getSubjectHash(): string { return $this->subjectHash; } public function getCategory(): string { return $this->category; } public function getChannel(): string { return $this->channel; } public function getSummary(): array { return $this->summary; } public function setSummary(array $summary): self { $this->summary = $summary; return $this; } public function getCreatedAt(): ?\DateTimeImmutable { return $this->createdAt; } public function getUpdatedAt(): ?\DateTimeImmutable { return $this->updatedAt; }}