replace annotation with attributes on Timestampable
This commit is contained in:
parent
4491c12684
commit
d80d02bc07
|
@ -6,28 +6,20 @@ use Doctrine\ORM\Mapping as ORM;
|
||||||
|
|
||||||
trait Timestampable
|
trait Timestampable
|
||||||
{
|
{
|
||||||
/**
|
#[ORM\Column(name: 'created_at', type: 'datetime')]
|
||||||
* @ORM\Column(name="created_at", type="datetime")
|
|
||||||
*/
|
|
||||||
protected $createdAt;
|
protected $createdAt;
|
||||||
|
|
||||||
/**
|
#[ORM\Column(name: 'updated_at', type: 'datetime')]
|
||||||
* @ORM\Column(name="updated_at", type="datetime")
|
|
||||||
*/
|
|
||||||
protected $updatedAt;
|
protected $updatedAt;
|
||||||
|
|
||||||
/**
|
#[ORM\PrePersist]
|
||||||
* @ORM\PrePersist
|
|
||||||
*/
|
|
||||||
public function onPrePersist(): void
|
public function onPrePersist(): void
|
||||||
{
|
{
|
||||||
$this->createdAt = new \DateTime();
|
$this->createdAt = new \DateTime();
|
||||||
$this->updatedAt = new \DateTime();
|
$this->updatedAt = new \DateTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
#[ORM\PreUpdate]
|
||||||
* @ORM\PreUpdate
|
|
||||||
*/
|
|
||||||
public function onPreUpdate(): void
|
public function onPreUpdate(): void
|
||||||
{
|
{
|
||||||
$this->updatedAt = new \DateTime();
|
$this->updatedAt = new \DateTime();
|
||||||
|
|
Loading…
Reference in a new issue