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/UserBundle/Entity | |
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/UserBundle/Entity')
-rw-r--r-- | src/Wallabag/UserBundle/Entity/User.php | 16 |
1 files changed, 3 insertions, 13 deletions
diff --git a/src/Wallabag/UserBundle/Entity/User.php b/src/Wallabag/UserBundle/Entity/User.php index 53c327f9..48446e3c 100644 --- a/src/Wallabag/UserBundle/Entity/User.php +++ b/src/Wallabag/UserBundle/Entity/User.php | |||
@@ -15,6 +15,7 @@ use Symfony\Component\Security\Core\User\UserInterface; | |||
15 | use Wallabag\ApiBundle\Entity\Client; | 15 | use Wallabag\ApiBundle\Entity\Client; |
16 | use Wallabag\CoreBundle\Entity\Config; | 16 | use Wallabag\CoreBundle\Entity\Config; |
17 | use Wallabag\CoreBundle\Entity\Entry; | 17 | use Wallabag\CoreBundle\Entity\Entry; |
18 | use Wallabag\CoreBundle\Helper\EntityTimestampsTrait; | ||
18 | 19 | ||
19 | /** | 20 | /** |
20 | * User. | 21 | * User. |
@@ -29,6 +30,8 @@ use Wallabag\CoreBundle\Entity\Entry; | |||
29 | */ | 30 | */ |
30 | class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterface | 31 | class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterface |
31 | { | 32 | { |
33 | use EntityTimestampsTrait; | ||
34 | |||
32 | /** @Serializer\XmlAttribute */ | 35 | /** @Serializer\XmlAttribute */ |
33 | /** | 36 | /** |
34 | * @var int | 37 | * @var int |
@@ -139,19 +142,6 @@ class User extends BaseUser implements TwoFactorInterface, TrustedComputerInterf | |||
139 | } | 142 | } |
140 | 143 | ||
141 | /** | 144 | /** |
142 | * @ORM\PrePersist | ||
143 | * @ORM\PreUpdate | ||
144 | */ | ||
145 | public function timestamps() | ||
146 | { | ||
147 | if (null === $this->createdAt) { | ||
148 | $this->createdAt = new \DateTime(); | ||
149 | } | ||
150 | |||
151 | $this->updatedAt = new \DateTime(); | ||
152 | } | ||
153 | |||
154 | /** | ||
155 | * Set name. | 145 | * Set name. |
156 | * | 146 | * |
157 | * @param string $name | 147 | * @param string $name |