3 namespace Wallabag\CoreBundle\Entity
;
5 use Doctrine\Common\Collections\ArrayCollection
;
6 use Doctrine\ORM\Mapping
as ORM
;
7 use Symfony\Component\Validator\Constraints
as Assert
;
8 use Hateoas\Configuration\Annotation
as Hateoas
;
9 use JMS\Serializer\Annotation\XmlRoot
;
15 * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\EntryRepository")
17 * @ORM\HasLifecycleCallbacks()
18 * @Hateoas\Relation("self", href = "expr('/api/entries/' ~ object.getId())")
22 /** @Serializer\XmlAttribute */
26 * @ORM\Column(name="id", type="integer")
28 * @ORM\GeneratedValue(strategy="AUTO")
35 * @ORM\Column(name="title", type="text", nullable=true)
43 * @ORM\Column(name="url", type="text", nullable=true)
50 * @ORM\Column(name="is_archived", type="boolean")
52 private $isArchived = false;
57 * @ORM\Column(name="is_starred", type="boolean")
59 private $isStarred = false;
64 * @ORM\Column(name="content", type="text", nullable=true)
71 * @ORM\Column(name="created_at", type="datetime")
78 * @ORM\Column(name="updated_at", type="datetime")
85 * @ORM\Column(name="comments", type="text", nullable=true)
92 * @ORM\Column(name="mimetype", type="text", nullable=true)
99 * @ORM\Column(name="language", type="text", nullable=true)
106 * @ORM\Column(name="reading_time", type="integer", nullable=true)
108 private $readingTime;
113 * @ORM\Column(name="domain_name", type="text", nullable=true)
120 * @ORM\Column(name="preview_picture", type="text", nullable=true)
122 private $previewPicture;
127 * @ORM\Column(name="is_public", type="boolean", nullable=true, options={"default" = false})
132 * @ORM\ManyToOne(targetEntity="User", inversedBy="entries")
137 * @ORM\ManyToMany(targetEntity="Tag", inversedBy="entries", cascade={"persist"})
145 public function __construct(User
$user)
148 $this->tags
= new ArrayCollection();
156 public function getId()
164 * @param string $title
168 public function setTitle($title)
170 $this->title
= $title;
180 public function getTitle()
192 public function setUrl($url)
204 public function getUrl()
212 * @param string $isArchived
216 public function setArchived($isArchived)
218 $this->isArchived
= $isArchived;
228 public function isArchived()
230 return $this->isArchived
;
233 public function toggleArchive()
235 $this->isArchived
= $this->isArchived() ^
1;
243 * @param string $isStarred
247 public function setStarred($isStarred)
249 $this->isStarred
= $isStarred;
259 public function isStarred()
261 return $this->isStarred
;
264 public function toggleStar()
266 $this->isStarred
= $this->isStarred() ^
1;
274 * @param string $content
278 public function setContent($content)
280 $this->content
= $content;
290 public function getContent()
292 return $this->content
;
298 public function getUser()
306 public function getCreatedAt()
308 return $this->createdAt
;
314 public function getUpdatedAt()
316 return $this->updatedAt
;
323 public function timestamps()
325 if (is_null($this->createdAt
)) {
326 $this->createdAt
= new \
DateTime();
329 $this->updatedAt
= new \
DateTime();
335 public function getComments()
337 return $this->comments
;
341 * @param string $comments
343 public function setComments($comments)
345 $this->comments
= $comments;
351 public function getMimetype()
353 return $this->mimetype
;
357 * @param string $mimetype
359 public function setMimetype($mimetype)
361 $this->mimetype
= $mimetype;
367 public function getReadingTime()
369 return $this->readingTime
;
373 * @param int $readingTime
375 public function setReadingTime($readingTime)
377 $this->readingTime
= $readingTime;
383 public function getDomainName()
385 return $this->domainName
;
389 * @param string $domainName
391 public function setDomainName($domainName)
393 $this->domainName
= $domainName;
399 public function isPublic()
401 return $this->isPublic
;
405 * @param bool $isPublic
407 public function setIsPublic($isPublic)
409 $this->isPublic
= $isPublic;
413 * @return ArrayCollection<Tag>
415 public function getTags()
423 public function addTag(Tag
$tag)
425 $this->tags
[] = $tag;
426 $tag->addEntry($this);
429 public function removeTag(Tag
$tag)
431 $this->tags
->removeElement($tag);
435 * Set previewPicture.
437 * @param string $previewPicture
441 public function setPreviewPicture($previewPicture)
443 $this->previewPicture
= $previewPicture;
449 * Get previewPicture.
453 public function getPreviewPicture()
455 return $this->previewPicture
;
461 * @param string $language
465 public function setLanguage($language)
467 $this->language
= $language;
477 public function getLanguage()
479 return $this->language
;