diff options
author | Jérémy Benoist <j0k3r@users.noreply.github.com> | 2017-07-11 07:30:08 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-11 07:30:08 +0200 |
commit | 9aa11176b89ab99c267c1d2353ef645c817c941d (patch) | |
tree | 4e6ddf6e2b76dfd76d0912e94d62a73aaa331685 /src/Wallabag/AnnotationBundle/Entity/Annotation.php | |
parent | 337e807297fb9700407ce6e4c4f7c307b4dae22c (diff) | |
parent | 927c9e796ff6fad2bf82a965234f52932cdee657 (diff) | |
download | wallabag-9aa11176b89ab99c267c1d2353ef645c817c941d.tar.gz wallabag-9aa11176b89ab99c267c1d2353ef645c817c941d.tar.zst wallabag-9aa11176b89ab99c267c1d2353ef645c817c941d.zip |
Merge pull request #3264 from wallabag/trait-timestamps
Add EntityTimestampsTrait to handle dates
Diffstat (limited to 'src/Wallabag/AnnotationBundle/Entity/Annotation.php')
-rw-r--r-- | src/Wallabag/AnnotationBundle/Entity/Annotation.php | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/Wallabag/AnnotationBundle/Entity/Annotation.php b/src/Wallabag/AnnotationBundle/Entity/Annotation.php index 04d83001..a180d504 100644 --- a/src/Wallabag/AnnotationBundle/Entity/Annotation.php +++ b/src/Wallabag/AnnotationBundle/Entity/Annotation.php | |||
@@ -10,6 +10,7 @@ use JMS\Serializer\Annotation\SerializedName; | |||
10 | use JMS\Serializer\Annotation\VirtualProperty; | 10 | use JMS\Serializer\Annotation\VirtualProperty; |
11 | use Symfony\Component\Validator\Constraints as Assert; | 11 | use Symfony\Component\Validator\Constraints as Assert; |
12 | use Wallabag\CoreBundle\Entity\Entry; | 12 | use Wallabag\CoreBundle\Entity\Entry; |
13 | use Wallabag\CoreBundle\Helper\EntityTimestampsTrait; | ||
13 | use Wallabag\UserBundle\Entity\User; | 14 | use Wallabag\UserBundle\Entity\User; |
14 | 15 | ||
15 | /** | 16 | /** |
@@ -22,6 +23,8 @@ use Wallabag\UserBundle\Entity\User; | |||
22 | */ | 23 | */ |
23 | class Annotation | 24 | class Annotation |
24 | { | 25 | { |
26 | use EntityTimestampsTrait; | ||
27 | |||
25 | /** | 28 | /** |
26 | * @var int | 29 | * @var int |
27 | * | 30 | * |
@@ -134,18 +137,6 @@ class Annotation | |||
134 | } | 137 | } |
135 | 138 | ||
136 | /** | 139 | /** |
137 | * @ORM\PrePersist | ||
138 | * @ORM\PreUpdate | ||
139 | */ | ||
140 | public function timestamps() | ||
141 | { | ||
142 | if (null === $this->createdAt) { | ||
143 | $this->createdAt = new \DateTime(); | ||
144 | } | ||
145 | $this->updatedAt = new \DateTime(); | ||
146 | } | ||
147 | |||
148 | /** | ||
149 | * Get created. | 140 | * Get created. |
150 | * | 141 | * |
151 | * @return \DateTime | 142 | * @return \DateTime |