]> git.immae.eu Git - github/wallabag/wallabag.git/blobdiff - src/Wallabag/CoreBundle/Entity/Entry.php
CS
[github/wallabag/wallabag.git] / src / Wallabag / CoreBundle / Entity / Entry.php
index 3c742828522935830b11bc90c426946ef63acbdb..c3e6b4d5d35305b3ff3b7fbca1ec58365b7489ea 100644 (file)
@@ -38,7 +38,7 @@ class Entry
     private $id;
 
     /**
-     * @var int
+     * @var string
      *
      * @ORM\Column(name="uuid", type="text", nullable=true)
      *
@@ -101,7 +101,7 @@ class Entry
      *
      * @ORM\Column(name="created_at", type="datetime")
      *
-     * @Groups({"export_all"})
+     * @Groups({"entries_for_user", "export_all"})
      */
     private $createdAt;
 
@@ -110,7 +110,7 @@ class Entry
      *
      * @ORM\Column(name="updated_at", type="datetime")
      *
-     * @Groups({"export_all"})
+     * @Groups({"entries_for_user", "export_all"})
      */
     private $updatedAt;
 
@@ -436,8 +436,6 @@ class Entry
         }
 
         $this->updatedAt = new \DateTime();
-
-        $this->generateUuid();
     }
 
     /**
@@ -608,7 +606,7 @@ class Entry
     }
 
     /**
-     * @return int
+     * @return string
      */
     public function getUuid()
     {
@@ -616,7 +614,7 @@ class Entry
     }
 
     /**
-     * @param int $uuid
+     * @param string $uuid
      *
      * @return Entry
      */
@@ -629,8 +627,14 @@ class Entry
 
     public function generateUuid()
     {
-        if (empty($this->uuid) || is_null($this->uuid)) {
-            $this->uuid = uniqid();
+        if (null === $this->uuid) {
+            // @see http://blog.kevingomez.fr/til/2015/07/26/why-is-uniqid-slow/ for true parameter
+            $this->uuid = uniqid('', true);
         }
     }
+
+    public function cleanUuid()
+    {
+        $this->uuid = null;
+    }
 }