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
;
10 use Wallabag\UserBundle\Entity\User
;
16 * @ORM\Entity(repositoryClass="Wallabag\CoreBundle\Repository\EntryRepository")
18 * @ORM\HasLifecycleCallbacks()
19 * @Hateoas\Relation("self", href = "expr('/api/entries/' ~ object.getId())")
23 /** @Serializer\XmlAttribute */
27 * @ORM\Column(name="id", type="integer")
29 * @ORM\GeneratedValue(strategy="AUTO")
36 * @ORM\Column(name="title", type="text", nullable=true)
44 * @ORM\Column(name="url", type="text", nullable=true)
51 * @ORM\Column(name="is_archived", type="boolean")
53 private $isArchived = false;
58 * @ORM\Column(name="is_starred", type="boolean")
60 private $isStarred = false;
65 * @ORM\Column(name="content", type="text", nullable=true)
72 * @ORM\Column(name="created_at", type="datetime")
79 * @ORM\Column(name="updated_at", type="datetime")
86 * @ORM\Column(name="comments", type="text", nullable=true)
93 * @ORM\Column(name="mimetype", type="text", nullable=true)
100 * @ORM\Column(name="language", type="text", nullable=true)
107 * @ORM\Column(name="reading_time", type="integer", nullable=true)
109 private $readingTime;
114 * @ORM\Column(name="domain_name", type="text", nullable=true)
121 * @ORM\Column(name="preview_picture", type="text", nullable=true)
123 private $previewPicture;
128 * @ORM\Column(name="is_public", type="boolean", nullable=true, options={"default" = false})
133 * @ORM\ManyToOne(targetEntity="Wallabag\UserBundle\Entity\User", inversedBy="entries")
138 * @ORM\ManyToMany(targetEntity="Tag", inversedBy="entries", cascade={"persist"})
146 public function __construct(\Wallabag\UserBundle\Entity\User
$user)
149 $this->tags
= new ArrayCollection();
157 public function getId()
165 * @param string $title
169 public function setTitle($title)
171 $this->title
= $title;
181 public function getTitle()
193 public function setUrl($url)
205 public function getUrl()
213 * @param string $isArchived
217 public function setArchived($isArchived)
219 $this->isArchived
= $isArchived;
229 public function isArchived()
231 return $this->isArchived
;
234 public function toggleArchive()
236 $this->isArchived
= $this->isArchived() ^
1;
244 * @param string $isStarred
248 public function setStarred($isStarred)
250 $this->isStarred
= $isStarred;
260 public function isStarred()
262 return $this->isStarred
;
265 public function toggleStar()
267 $this->isStarred
= $this->isStarred() ^
1;
275 * @param string $content
279 public function setContent($content)
281 $this->content
= $content;
291 public function getContent()
293 return $this->content
;
299 public function getUser()
307 public function getCreatedAt()
309 return $this->createdAt
;
315 public function getUpdatedAt()
317 return $this->updatedAt
;
324 public function timestamps()
326 if (is_null($this->createdAt
)) {
327 $this->createdAt
= new \
DateTime();
330 $this->updatedAt
= new \
DateTime();
336 public function getComments()
338 return $this->comments
;
342 * @param string $comments
344 public function setComments($comments)
346 $this->comments
= $comments;
352 public function getMimetype()
354 return $this->mimetype
;
358 * @param string $mimetype
360 public function setMimetype($mimetype)
362 $this->mimetype
= $mimetype;
368 public function getReadingTime()
370 return $this->readingTime
;
374 * @param int $readingTime
376 public function setReadingTime($readingTime)
378 $this->readingTime
= $readingTime;
384 public function getDomainName()
386 return $this->domainName
;
390 * @param string $domainName
392 public function setDomainName($domainName)
394 $this->domainName
= $domainName;
400 public function isPublic()
402 return $this->isPublic
;
406 * @param bool $isPublic
408 public function setIsPublic($isPublic)
410 $this->isPublic
= $isPublic;
414 * @return ArrayCollection<Tag>
416 public function getTags()
424 public function addTag(Tag
$tag)
426 $this->tags
[] = $tag;
427 $tag->addEntry($this);
430 public function removeTag(Tag
$tag)
432 $this->tags
->removeElement($tag);
436 * Set previewPicture.
438 * @param string $previewPicture
442 public function setPreviewPicture($previewPicture)
444 $this->previewPicture
= $previewPicture;
450 * Get previewPicture.
454 public function getPreviewPicture()
456 return $this->previewPicture
;
462 * @param string $language
466 public function setLanguage($language)
468 $this->language
= $language;
478 public function getLanguage()
480 return $this->language
;