issues/27: filter DTO, strip id from payloads, lifecycle updateAt
This commit is contained in:
committed by
Valeriy Petrov
parent
da5f7bb242
commit
76044381fd
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Entity\Behavior;
|
||||
|
||||
use Doctrine\ORM\Mapping as ORM;
|
||||
|
||||
trait UpdateTimestampTrait
|
||||
{
|
||||
#[ORM\PrePersist]
|
||||
public function setInitialUpdateAt(): void
|
||||
{
|
||||
if ($this->updateAt === null) {
|
||||
$this->updateAt = new \DateTime();
|
||||
}
|
||||
}
|
||||
|
||||
#[ORM\PreUpdate]
|
||||
public function refreshUpdateAt(): void
|
||||
{
|
||||
$this->updateAt = new \DateTime();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user