Skip to content

Commit 977f99d

Browse files
authored
Merge pull request #21 from heiglandreas/hotfix/uniqueTags
Adds unique tags
2 parents cad6680 + 6cb8c52 commit 977f99d

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

src/Entity/Cfp.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ public function toArray()
9393
'cfp_start_date' => $this->dateStart->format('c'),
9494
'cfp_end_date' => $this->dateEnd->format('c'),
9595
'description' => $this->description,
96-
'tags' => $this->tags,
96+
'tags' => array_unique($this->tags),
9797
'start_date' => $this->eventStartDate->format('c'),
9898
'end_date' => $this->eventEndDate->format('c'),
9999
'location' => $this->location,
@@ -102,4 +102,11 @@ public function toArray()
102102
'timezone' => $this->timezone,
103103
);
104104
}
105+
106+
public function addTag($tag)
107+
{
108+
if (! in_array($tag, $this->tags)) {
109+
$this->tags[] = $tag;
110+
}
111+
}
105112
}

0 commit comments

Comments
 (0)