Search::setDatePremiere()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 6
ccs 3
cts 3
cp 1
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 3
nc 2
nop 1
crap 2
1
<?php
2
/**
3
 * AnimeDb package.
4
 *
5
 * @author    Peter Gribanov <[email protected]>
6
 * @copyright Copyright (c) 2011, Peter Gribanov
7
 * @license   http://opensource.org/licenses/GPL-3.0 GPL v3
8
 */
9
10
namespace AnimeDb\Bundle\CatalogBundle\Entity;
11
12
use Symfony\Component\Validator\Constraints as Assert;
13
use Doctrine\Common\Collections\ArrayCollection;
14
15
/**
16
 * Item search.
17
 *
18
 * @author  Peter Gribanov <[email protected]>
19
 */
20
class Search
21
{
22
    /**
23
     * @Assert\Date()
24
     *
25
     * @var \DateTime|null
26
     */
27
    protected $date_add;
28
29
    /**
30
     * @Assert\Date()
31
     *
32
     * @var \DateTime|null
33
     */
34
    protected $date_end;
35
36
    /**
37
     * @Assert\Date()
38
     *
39
     * @var \DateTime|null
40
     */
41
    protected $date_premiere;
42
43
    /**
44
     * @var ArrayCollection
45
     */
46
    protected $genres;
47
48
    /**
49
     * @var ArrayCollection
50
     */
51
    protected $labels;
52
53
    /**
54
     * @var Country|null
55
     */
56
    protected $country;
57
58
    /**
59
     * @var string
60
     */
61
    protected $name = '';
62
63
    /**
64
     * @var Storage|null
65
     */
66
    protected $storage;
67
68
    /**
69
     * @var Type|null
70
     */
71
    protected $type;
72
73
    /**
74
     * @var Studio|null
75
     */
76
    protected $studio;
77
78 128
    public function __construct()
79
    {
80 128
        $this->genres = new ArrayCollection();
81 128
        $this->labels = new ArrayCollection();
82 128
    }
83
84
    /**
85
     * @param string $name
86
     *
87
     * @return Search
88
     */
89 1
    public function setName($name)
90
    {
91 1
        $this->name = $name;
92
93 1
        return $this;
94
    }
95
96
    /**
97
     * @return string
98
     */
99 1
    public function getName()
100
    {
101 1
        return $this->name;
102
    }
103
104
    /**
105
     * @param \DateTime|null $date_add
106
     *
107
     * @return Search
108
     */
109 1
    public function setDateAdd(\DateTime $date_add = null)
110
    {
111 1
        $this->date_add = $date_add ? clone $date_add : $date_add;
112
113 1
        return $this;
114
    }
115
116
    /**
117
     * @return \DateTime|null
118
     */
119 1
    public function getDateAdd()
120
    {
121 1
        return $this->date_add ? clone $this->date_add : null;
122
    }
123
124
    /**
125
     * @param \DateTime|null $date_premiere
126
     *
127
     * @return Search
128
     */
129 1
    public function setDatePremiere(\DateTime $date_premiere = null)
130
    {
131 1
        $this->date_premiere = $date_premiere ? clone $date_premiere : $date_premiere;
132
133 1
        return $this;
134
    }
135
136
    /**
137
     * @return \DateTime|null
138
     */
139 1
    public function getDatePremiere()
140
    {
141 1
        return $this->date_premiere ? clone $this->date_premiere : null;
142
    }
143
144
    /**
145
     * @param \DateTime|null $date_end
146
     *
147
     * @return Search
148
     */
149 1
    public function setDateEnd(\DateTime $date_end = null)
150
    {
151 1
        $this->date_end = $date_end ? clone $date_end : null;
152
153 1
        return $this;
154
    }
155
156
    /**
157
     * @return \DateTime|null
158
     */
159 1
    public function getDateEnd()
160
    {
161 1
        return $this->date_end ? clone $this->date_end : null;
162
    }
163
164
    /**
165
     * @param Genre $genre
166
     *
167
     * @return Search
168
     */
169 1
    public function addGenre(Genre $genre)
170
    {
171 1
        if (!$this->genres->contains($genre)) {
172 1
            $this->genres->add($genre);
173 1
        }
174
175 1
        return $this;
176
    }
177
178
    /**
179
     * @param Genre $genre
180
     *
181
     * @return Search
182
     */
183 1
    public function removeGenre(Genre $genre)
184
    {
185 1
        $this->genres->removeElement($genre);
186
187 1
        return $this;
188
    }
189
190
    /**
191
     * @return ArrayCollection
192
     */
193 1
    public function getGenres()
194
    {
195 1
        return $this->genres;
196
    }
197
198
    /**
199
     * @param Label $label
200
     *
201
     * @return Search
202
     */
203 1
    public function addLabel(Label $label)
204
    {
205 1
        if (!$this->labels->contains($label)) {
206 1
            $this->labels->add($label);
207 1
        }
208
209 1
        return $this;
210
    }
211
212
    /**
213
     * @param Label $label
214
     *
215
     * @return Search
216
     */
217 1
    public function removeLabel(Label $label)
218
    {
219 1
        $this->labels->removeElement($label);
220
221 1
        return $this;
222
    }
223
224
    /**
225
     * @return ArrayCollection
226
     */
227 1
    public function getLabels()
228
    {
229 1
        return $this->labels;
230
    }
231
232
    /**
233
     * @return Country
234
     */
235 1
    public function getCountry()
236
    {
237 1
        return $this->country;
238
    }
239
240
    /**
241
     * @param Country|null $country
242
     *
243
     * @return Search
244
     */
245 1
    public function setCountry(Country $country = null)
246
    {
247 1
        if ($this->country !== $country) {
248 1
            $this->country = $country;
249 1
        }
250
251 1
        return $this;
252
    }
253
254
    /**
255
     * @param Storage|null $storage
256
     *
257
     * @return Search
258
     */
259 1
    public function setStorage(Storage $storage = null)
260
    {
261 1
        if ($this->storage !== $storage) {
262 1
            $this->storage = $storage;
263 1
        }
264
265 1
        return $this;
266
    }
267
268
    /**
269
     * @return Storage
270
     */
271 1
    public function getStorage()
272
    {
273 1
        return $this->storage;
274
    }
275
276
    /**
277
     * @param Type $type
278
     *
279
     * @return Search
280
     */
281 1
    public function setType(Type $type = null)
282
    {
283 1
        if ($this->type !== $type) {
284 1
            $this->type = $type;
285 1
        }
286
287 1
        return $this;
288
    }
289
290
    /**
291
     * @return Type
292
     */
293 1
    public function getType()
294
    {
295 1
        return $this->type;
296
    }
297
298
    /**
299
     * @param Studio $studio
300
     *
301
     * @return Search
302
     */
303 1
    public function setStudio(Studio $studio = null)
304
    {
305 1
        if ($this->studio !== $studio) {
306 1
            $this->studio = $studio;
307 1
        }
308
309 1
        return $this;
310
    }
311
312
    /**
313
     * @return Studio
314
     */
315 1
    public function getStudio()
316
    {
317 1
        return $this->studio;
318
    }
319
}
320