1 | <?php |
||
8 | class Tag implements TagInterface |
||
9 | { |
||
10 | /** |
||
11 | * @var int |
||
12 | */ |
||
13 | protected $id; |
||
14 | |||
15 | /** |
||
16 | * @var string |
||
17 | */ |
||
18 | protected $name; |
||
19 | |||
20 | /** |
||
21 | * @var Collection|TaggingInterface[] |
||
22 | */ |
||
23 | protected $taggings; |
||
24 | |||
25 | public function __construct() |
||
29 | |||
30 | /** |
||
31 | * {@inheritdoc} |
||
32 | */ |
||
33 | public function getId() |
||
37 | |||
38 | /** |
||
39 | * {@inheritdoc} |
||
40 | */ |
||
41 | public function getName() |
||
45 | |||
46 | /** |
||
47 | * {@inheritdoc} |
||
48 | */ |
||
49 | public function setName($name) |
||
53 | |||
54 | /** |
||
55 | * {@inheritdoc} |
||
56 | */ |
||
57 | public function getTaggings() |
||
61 | |||
62 | /** |
||
63 | * {@inheritdoc} |
||
64 | */ |
||
65 | public function setTaggings($taggings) |
||
66 | { |
||
67 | if (!$taggings instanceof Collection) { |
||
68 | $taggings = new ArrayCollection($taggings); |
||
69 | } |
||
70 | |||
71 | foreach($taggings as $tagging) { |
||
72 | $tagging->setTag($this); |
||
73 | } |
||
74 | |||
75 | $this->taggings = $taggings; |
||
76 | } |
||
77 | |||
78 | /** |
||
79 | * {@inheritdoc} |
||
80 | */ |
||
81 | public function hasTagging(TaggingInterface $tagging) |
||
85 | |||
86 | /** |
||
87 | * {@inheritdoc} |
||
88 | */ |
||
89 | public function addTagging(TaggingInterface $tagging) |
||
96 | |||
97 | /** |
||
98 | * {@inheritdoc} |
||
99 | */ |
||
100 | public function removeTagging(TaggingInterface $tagging) |
||
107 | } |
||
108 |