/**
* @var bool
*
+ * @Exclude
+ *
* @ORM\Column(name="is_archived", type="boolean")
*
* @Groups({"entries_for_user", "export_all"})
/**
* @var bool
*
+ * @Exclude
+ *
* @ORM\Column(name="is_starred", type="boolean")
*
* @Groups({"entries_for_user", "export_all"})
private $user;
/**
- * @ORM\ManyToMany(targetEntity="Tag", inversedBy="entries", cascade={"persist", "remove"})
- * @ORM\JoinTable
+ * @ORM\ManyToMany(targetEntity="Tag", inversedBy="entries", cascade={"persist"})
+ * @ORM\JoinTable(
+ * name="entry_tag",
+ * joinColumns={
+ * @ORM\JoinColumn(name="entry_id", referencedColumnName="id")
+ * },
+ * inverseJoinColumns={
+ * @ORM\JoinColumn(name="tag_id", referencedColumnName="id")
+ * }
+ * )
*
* @Groups({"entries_for_user", "export_all"})
*/
/*
* @param User $user
*/
- public function __construct(\Wallabag\UserBundle\Entity\User $user)
+ public function __construct(User $user)
{
$this->user = $user;
$this->tags = new ArrayCollection();
return $this->isArchived;
}
+ /**
+ * @VirtualProperty
+ * @SerializedName("is_archived")
+ * @Groups({"entries_for_user", "export_all"})
+ */
+ public function is_Archived()
+ {
+ return (int) $this->isArchived();
+ }
+
public function toggleArchive()
{
$this->isArchived = $this->isArchived() ^ 1;
return $this->isStarred;
}
+ /**
+ * @VirtualProperty
+ * @SerializedName("is_starred")
+ * @Groups({"entries_for_user", "export_all"})
+ */
+ public function is_Starred()
+ {
+ return (int) $this->isStarred();
+ }
+
public function toggleStar()
{
$this->isStarred = $this->isStarred() ^ 1;
}
}
- $this->tags[] = $tag;
+ $this->tags->add($tag);
$tag->addEntry($this);
}
public function removeTag(Tag $tag)
{
+ if (!$this->tags->contains($tag)) {
+ return;
+ }
+
$this->tags->removeElement($tag);
+ $tag->removeEntry($this);
}
/**