. */ namespace App\Entity\LogSystem; use App\Entity\Contracts\LogWithEventUndoInterface; use App\Services\LogSystem\EventUndoMode; trait LogWithEventUndoTrait { public function isUndoEvent(): bool { return isset($this->extra['u']); } public function getUndoEventID(): ?int { return $this->extra['u'] ?? null; } public function setUndoneEvent(AbstractLogEntry $event, EventUndoMode $mode = EventUndoMode::UNDO): LogWithEventUndoInterface { $this->extra['u'] = $event->getID(); $this->extra['um'] = $mode->toExtraInt(); return $this; } public function getUndoMode(): EventUndoMode { $mode_int = $this->extra['um'] ?? 1; return EventUndoMode::fromExtraInt($mode_int); } }