/**
* Set isArchived.
*
- * @param string $isArchived
+ * @param bool $isArchived
*
* @return Entry
*/
/**
* Get isArchived.
*
- * @return string
+ * @return bool
*/
public function isArchived()
{
/**
* Set isStarred.
*
- * @param string $isStarred
+ * @param bool $isStarred
*
* @return Entry
*/
/**
* Get isStarred.
*
- * @return string
+ * @return bool
*/
public function isStarred()
{
*/
public function addTag(Tag $tag)
{
+ if ($this->tags->contains($tag)) {
+ return;
+ }
+
+ // check if tag already exist but has not yet be persisted
+ // it seems that the previous condition with `contains()` doesn't check that case
+ foreach ($this->tags as $existingTag) {
+ if ($existingTag->getLabel() === $tag->getLabel()) {
+ return;
+ }
+ }
+
$this->tags[] = $tag;
$tag->addEntry($this);
}