Share entry with a public URL

This commit is contained in:
Nicolas Lœuillet
2016-04-10 17:33:15 +02:00
parent 1bee9e0760
commit f3d0cb9106
5 changed files with 116 additions and 1 deletions

View File

@ -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();
}
}
}