use JMS\Serializer\Annotation\XmlRoot;
use JMS\Serializer\Annotation\ExclusionPolicy;
use JMS\Serializer\Annotation\Expose;
+use Doctrine\Common\Collections\ArrayCollection;
/**
* Tag
private $label;
/**
- * @ORM\ManyToMany(targetEntity="Entry", mappedBy="tags", cascade={"persist", "merge"})
+ * @ORM\ManyToMany(targetEntity="Entry", mappedBy="tags", cascade={"persist"})
*/
private $entries;
+ /**
+ * @ORM\ManyToOne(targetEntity="User", inversedBy="tags")
+ */
+ private $user;
+
+ public function __construct(User $user)
+ {
+ $this->user = $user;
+ $this->entries = new ArrayCollection();
+ }
/**
* Get id
*
{
return $this->label;
}
+
+ public function addEntry(Entry $entry)
+ {
+ $this->entries[] = $entry;
+ }
}