Files
slovnik30/app/model/Database/Entity/Attributes/TUpdatedAt.php
2022-01-13 18:41:03 +01:00

34 lines
504 B
PHP

<?php declare(strict_types = 1);
namespace App\Model\Database\Entity\Attributes;
use App\Model\Utils\DateTime;
use Doctrine\ORM\Mapping as ORM;
trait TUpdatedAt
{
/**
* @var DateTime|NULL
* @ORM\Column(type="datetime", nullable=TRUE)
*/
protected $updatedAt;
public function getUpdatedAt(): ?DateTime
{
return $this->updatedAt;
}
/**
* Doctrine annotation
*
* @ORM\PreUpdate
* @internal
*/
public function setUpdatedAt(): void
{
$this->updatedAt = new DateTime();
}
}