]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Entity/Entry.php
Add EntityTimestampsTrait to handle dates
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Entity / Entry.php
index cba72d31e07385ba736638df84c14862a31cf5a1..61d01bdcdadd5f0a52ceb3e66f08ae1eb0228cb9 100644 (file)
@@ -12,6 +12,7 @@ use JMS\Serializer\Annotation\VirtualProperty;
 use JMS\Serializer\Annotation\XmlRoot;
 use Symfony\Component\Validator\Constraints as Assert;
 use Wallabag\AnnotationBundle\Entity\Annotation;
+use Wallabag\CoreBundle\Helper\EntityTimestampsTrait;
 use Wallabag\UserBundle\Entity\User;
 
 /**
@@ -32,6 +33,8 @@ use Wallabag\UserBundle\Entity\User;
  */
 class Entry
 {
+    use EntityTimestampsTrait;
+
     /** @Serializer\XmlAttribute */
     /**
      * @var int
@@ -472,19 +475,6 @@ class Entry
         return $this->updatedAt;
     }
 
-    /**
-     * @ORM\PrePersist
-     * @ORM\PreUpdate
-     */
-    public function timestamps()
-    {
-        if (null === $this->createdAt) {
-            $this->createdAt = new \DateTime();
-        }
-
-        $this->updatedAt = new \DateTime();
-    }
-
     /**
      * @return ArrayCollection<Annotation>
      */