X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FEntity%2FEntry.php;h=a629efc763e454fe28172256d3f326363fd44396;hb=a7e2218e253138ed53e18b4775dce291c78246c5;hp=ceae78b05556e4005f0c51e35e1eb93a5bf6c57a;hpb=3be047456d6f91d8ef5404c9c7698e0d1f9a057d;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Entity/Entry.php b/src/Wallabag/CoreBundle/Entity/Entry.php index ceae78b0..a629efc7 100644 --- a/src/Wallabag/CoreBundle/Entity/Entry.php +++ b/src/Wallabag/CoreBundle/Entity/Entry.php @@ -37,6 +37,15 @@ class Entry */ private $id; + /** + * @var int + * + * @ORM\Column(name="uuid", type="text", nullable=true) + * + * @Groups({"entries_for_user", "export_all"}) + */ + private $uuid; + /** * @var string * @@ -427,6 +436,8 @@ class Entry } $this->updatedAt = new \DateTime(); + + $this->generateUuid(); } /** @@ -595,4 +606,32 @@ class Entry { return $this->language; } + + /** + * @return int + */ + public function getUuid() + { + return $this->uuid; + } + + /** + * @param int $uuid + * + * @return Entry + */ + public function setUuid($uuid) + { + $this->uuid = $uuid; + + return $this; + } + + public function generateUuid() + { + if (empty($this->uuid) || is_null($this->uuid)) { + // @see http://blog.kevingomez.fr/til/2015/07/26/why-is-uniqid-slow/ for true parameter + $this->uuid = uniqid('', true); + } + } }