private $id;
/**
- * @var int
+ * @var string
*
* @ORM\Column(name="uuid", type="text", nullable=true)
*
private $content;
/**
- * @var date
+ * @var \DateTime
*
* @ORM\Column(name="created_at", type="datetime")
*
- * @Groups({"export_all"})
+ * @Groups({"entries_for_user", "export_all"})
*/
private $createdAt;
/**
- * @var date
+ * @var \DateTime
*
* @ORM\Column(name="updated_at", type="datetime")
*
- * @Groups({"export_all"})
+ * @Groups({"entries_for_user", "export_all"})
*/
private $updatedAt;
}
/**
- * @return string
+ * Set created_at.
+ * Only used when importing data from an other service.
+ *
+ * @param \DateTime $createdAt
+ *
+ * @return Entry
+ */
+ public function setCreatedAt(\DateTime $createdAt)
+ {
+ $this->createdAt = $createdAt;
+
+ return $this;
+ }
+
+ /**
+ * @return \DateTime
*/
public function getCreatedAt()
{
}
/**
- * @return string
+ * @return \DateTime
*/
public function getUpdatedAt()
{
}
$this->updatedAt = new \DateTime();
-
- $this->generateUuid();
}
/**
}
/**
- * @return int
+ * @return string
*/
public function getUuid()
{
}
/**
- * @param int $uuid
+ * @param string $uuid
*
* @return Entry
*/
public function generateUuid()
{
- if (empty($this->uuid) || is_null($this->uuid)) {
+ 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;
+ }
}