issues/27: Harden ContentFilterDto query parsing; use DateTimeImmutable in UpdateTimestampTrait

This commit is contained in:
Valery Petrov
2026-05-15 16:29:30 +03:00
committed by Valeriy Petrov
parent 7a4fda31a4
commit 4f76693fe1
2 changed files with 18 additions and 3 deletions
+7 -2
View File
@@ -6,19 +6,24 @@ namespace App\Entity\Behavior;
use Doctrine\ORM\Mapping as ORM;
/**
* Требует у класса-сущности свойство `$updateAt` (mapped column).
*
* @property \DateTimeInterface|null $updateAt
*/
trait UpdateTimestampTrait
{
#[ORM\PrePersist]
public function setInitialUpdateAt(): void
{
if ($this->updateAt === null) {
$this->updateAt = new \DateTime();
$this->updateAt = new \DateTimeImmutable();
}
}
#[ORM\PreUpdate]
public function refreshUpdateAt(): void
{
$this->updateAt = new \DateTime();
$this->updateAt = new \DateTimeImmutable();
}
}