Added some simple time travel mechanism for part view.

In the moment it is not possible to show elements that were deleted.
This commit is contained in:
Jan Böhmer 2020-02-16 23:48:57 +01:00
parent a9fd1f9c68
commit 464a487a17
15 changed files with 450 additions and 27 deletions

View file

@ -26,12 +26,13 @@ namespace App\Entity\LogSystem;
use App\Entity\Base\AbstractDBElement;
use App\Entity\Contracts\NamedElementInterface;
use App\Entity\Contracts\TimeTravelInterface;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Entity()
*/
class ElementDeletedLogEntry extends AbstractLogEntry
class ElementDeletedLogEntry extends AbstractLogEntry implements TimeTravelInterface
{
protected $typeString = 'element_deleted';
@ -65,4 +66,31 @@ class ElementDeletedLogEntry extends AbstractLogEntry
{
return $this->extra['n'] ?? null;
}
/**
* Sets the old data for this entry.
* @param array $old_data
* @return $this
*/
public function setOldData(array $old_data): self
{
$this->extra['o'] = $old_data;
return $this;
}
/**
* @inheritDoc
*/
public function hasOldDataInformations(): bool
{
return !empty($this->extra['d']);
}
/**
* @inheritDoc
*/
public function getOldData(): array
{
return $this->extra['d'] ?? [];
}
}