namespace Wallabag\CoreBundle\Entity;
+use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
use Hateoas\Configuration\Annotation as Hateoas;
*/
private $user;
+ /**
+ * @ORM\ManyToMany(targetEntity="Tag", inversedBy="entries", cascade={"persist"})
+ * @ORM\JoinTable(name="entry_tags")
+ */
+ private $tags;
+
/*
* @param User $user
*/
public function __construct(User $user)
{
$this->user = $user;
+ $this->tags = new ArrayCollection();
}
/**
{
$this->isPublic = $isPublic;
}
+
+ /**
+ * @return ArrayCollection<Tag>
+ */
+ public function getTags()
+ {
+ return $this->tags;
+ }
+
+ /**
+ * @param Tag $tag
+ */
+ public function addTag(Tag $tag)
+ {
+ $this->tags[] = $tag;
+ $tag->addEntry($this);
+ }
}