From d80d02bc078745faec8f699bfaeffc5c102b2e56 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Thu, 24 Nov 2022 19:02:37 +0100 Subject: [PATCH] replace annotation with attributes on Timestampable --- src/core/Doctrine/Timestampable.php | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/src/core/Doctrine/Timestampable.php b/src/core/Doctrine/Timestampable.php index 41ff4b9..4ac1b35 100644 --- a/src/core/Doctrine/Timestampable.php +++ b/src/core/Doctrine/Timestampable.php @@ -6,28 +6,20 @@ use Doctrine\ORM\Mapping as ORM; trait Timestampable { - /** - * @ORM\Column(name="created_at", type="datetime") - */ + #[ORM\Column(name: 'created_at', type: 'datetime')] protected $createdAt; - /** - * @ORM\Column(name="updated_at", type="datetime") - */ + #[ORM\Column(name: 'updated_at', type: 'datetime')] protected $updatedAt; - /** - * @ORM\PrePersist - */ + #[ORM\PrePersist] public function onPrePersist(): void { $this->createdAt = new \DateTime(); $this->updatedAt = new \DateTime(); } - /** - * @ORM\PreUpdate - */ + #[ORM\PreUpdate] public function onPreUpdate(): void { $this->updatedAt = new \DateTime();