mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-25 19:28:51 +02:00
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:
parent
a9fd1f9c68
commit
464a487a17
15 changed files with 450 additions and 27 deletions
|
@ -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'] ?? [];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue