X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FEntity%2FEntry.php;h=3c742828522935830b11bc90c426946ef63acbdb;hb=f3d0cb91063840f2b05c63954d3fef3e5b8943fd;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..3c742828 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,31 @@ 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)) { + $this->uuid = uniqid(); + } + } }