Commit | Line | Data |
---|---|---|
929ca066 BA |
1 | <?php |
2 | ||
3 | namespace Mixstore\StoreBundle\Entity; | |
4 | ||
5 | use Doctrine\ORM\Mapping as ORM; | |
6 | use Symfony\Component\Validator\Constraints as Assert; | |
7 | ||
8 | /** | |
9 | * Package | |
10 | * | |
11 | * @ORM\Table() | |
12 | * @ORM\Entity(repositoryClass="Mixstore\StoreBundle\Entity\PackageRepository") | |
13 | */ | |
14 | class Package | |
15 | { | |
16 | /** | |
17 | * @var integer | |
18 | * | |
19 | * @ORM\Column(name="id", type="integer") | |
20 | * @ORM\Id | |
21 | * @ORM\GeneratedValue(strategy="AUTO") | |
22 | */ | |
23 | private $id; | |
24 | ||
25 | /** | |
26 | * @ORM\Column(type="datetime") | |
27 | * @Assert\NotBlank() | |
28 | */ | |
29 | private $created; | |
30 | ||
31 | /** | |
32 | * @ORM\Column(type="datetime") | |
33 | * @Assert\NotBlank() | |
34 | */ | |
35 | private $modified; | |
36 | ||
37 | /** | |
38 | * @ORM\Column(type="string", unique=true) | |
39 | * @Assert\NotBlank() | |
40 | */ | |
41 | private $name; | |
42 | ||
43 | /** | |
44 | * @ORM\Column(type="text") | |
45 | * @Assert\NotBlank() | |
46 | */ | |
47 | private $headline; | |
48 | ||
49 | /** | |
50 | * @ORM\Column(type="string") | |
51 | * @Assert\NotBlank() | |
52 | * @Assert\Url() | |
53 | */ | |
54 | private $url; | |
55 | ||
56 | /** | |
57 | * @ORM\Column(type="text", nullable=true) | |
58 | */ | |
59 | private $description; | |
60 | ||
61 | /** | |
62 | * @ORM\Column(type="text", nullable=true) | |
63 | */ | |
64 | private $dependencies; | |
65 | ||
66 | /** | |
67 | * @ORM\Column(type="text") | |
68 | * @Assert\NotBlank() | |
69 | */ | |
70 | private $authors; | |
71 | ||
72 | /** | |
73 | * @ORM\Column(type="string") | |
74 | * @Assert\NotBlank() | |
75 | * @Assert\Email() | |
76 | */ | |
77 | private $contact; //un email | |
78 | ||
79 | /** | |
80 | * @ORM\ManyToOne(targetEntity="Mixstore\UserBundle\Entity\User") | |
81 | * @ORM\JoinColumn(nullable=false) | |
82 | */ | |
83 | private $user; //owner of the package: "webmaster"... | |
84 | ||
85 | /** | |
86 | * @ORM\ManyToOne(targetEntity="Mixstore\StoreBundle\Entity\Language") | |
87 | * @ORM\JoinColumn(nullable=false) | |
88 | */ | |
89 | private $language; | |
90 | ||
91 | /** | |
92 | * @ORM\Column(type="string", nullable=true) | |
93 | */ | |
94 | private $bannerpath; //chemin vers banner image | |
95 | ||
96 | // --- | |
97 | //quick ugly way: TOFIX | |
98 | public $bannerfile; | |
99 | public $removebanner; | |
100 | // --- | |
101 | ||
102 | public function __construct() | |
103 | { | |
104 | $this->user = null; | |
105 | $this->id = 0; | |
106 | $this->created = new \DateTime('now'); | |
107 | $this->modified = new \DateTime('now'); | |
108 | } | |
109 | ||
110 | /** | |
111 | * Get id | |
112 | * | |
113 | * @return integer | |
114 | */ | |
115 | public function getId() | |
116 | { | |
117 | return $this->id; | |
118 | } | |
119 | ||
120 | //un package a un "webmaster ID" (masqué sur la page du package, mais permettant de savoir qui a le droit de l'éditer) | |
121 | ||
122 | /** | |
123 | * Set name | |
124 | * | |
125 | * @param string $name | |
126 | * @return Package | |
127 | */ | |
128 | public function setName($name) | |
129 | { | |
130 | $this->name = $name; | |
131 | ||
132 | return $this; | |
133 | } | |
134 | ||
135 | /** | |
136 | * Get name | |
137 | * | |
138 | * @return string | |
139 | */ | |
140 | public function getName() | |
141 | { | |
142 | return $this->name; | |
143 | } | |
144 | ||
145 | /** | |
146 | * Set url | |
147 | * | |
148 | * @param string $url | |
149 | * @return Package | |
150 | */ | |
151 | public function setUrl($url) | |
152 | { | |
153 | $this->url = $url; | |
154 | ||
155 | return $this; | |
156 | } | |
157 | ||
158 | /** | |
159 | * Get url | |
160 | * | |
161 | * @return string | |
162 | */ | |
163 | public function getUrl() | |
164 | { | |
165 | return $this->url; | |
166 | } | |
167 | ||
168 | /** | |
169 | * Set description | |
170 | * | |
171 | * @param string $description | |
172 | * @return Package | |
173 | */ | |
174 | public function setDescription($description) | |
175 | { | |
176 | $this->description = $description; | |
177 | ||
178 | return $this; | |
179 | } | |
180 | ||
181 | /** | |
182 | * Get description | |
183 | * | |
184 | * @return string | |
185 | */ | |
186 | public function getDescription() | |
187 | { | |
188 | return $this->description; | |
189 | } | |
190 | ||
191 | /** | |
192 | * Set authors | |
193 | * | |
194 | * @param string $authors | |
195 | * @return Package | |
196 | */ | |
197 | public function setAuthors($authors) | |
198 | { | |
199 | $this->authors = $authors; | |
200 | ||
201 | return $this; | |
202 | } | |
203 | ||
204 | /** | |
205 | * Get authors | |
206 | * | |
207 | * @return string | |
208 | */ | |
209 | public function getAuthors() | |
210 | { | |
211 | return $this->authors; | |
212 | } | |
213 | ||
214 | /** | |
215 | * Set contact | |
216 | * | |
217 | * @param string $contact | |
218 | * @return Package | |
219 | */ | |
220 | public function setContact($contact) | |
221 | { | |
222 | $this->contact = $contact; | |
223 | ||
224 | return $this; | |
225 | } | |
226 | ||
227 | /** | |
228 | * Get contact | |
229 | * | |
230 | * @return string | |
231 | */ | |
232 | public function getContact() | |
233 | { | |
234 | return $this->contact; | |
235 | } | |
236 | ||
237 | /** | |
238 | * Set user | |
239 | * | |
240 | * @param \Mixstore\UserBundle\Entity\User $user | |
241 | * @return Package | |
242 | */ | |
243 | public function setUser(\Mixstore\UserBundle\Entity\User $user) | |
244 | { | |
245 | $this->user = $user; | |
246 | ||
247 | return $this; | |
248 | } | |
249 | ||
250 | /** | |
251 | * Get user | |
252 | * | |
253 | * @return \Mixstore\UserBundle\Entity\User | |
254 | */ | |
255 | public function getUser() | |
256 | { | |
257 | return $this->user; | |
258 | } | |
259 | ||
260 | /** | |
261 | * Set headline | |
262 | * | |
263 | * @param string $headline | |
264 | * @return Package | |
265 | */ | |
266 | public function setHeadline($headline) | |
267 | { | |
268 | $this->headline = $headline; | |
269 | ||
270 | return $this; | |
271 | } | |
272 | ||
273 | /** | |
274 | * Get headline | |
275 | * | |
276 | * @return string | |
277 | */ | |
278 | public function getHeadline() | |
279 | { | |
280 | return $this->headline; | |
281 | } | |
282 | ||
283 | /** | |
284 | * Set bannerpath | |
285 | * | |
286 | * @param string $bannerpath | |
287 | * @return Package | |
288 | */ | |
289 | public function setBannerpath($bannerpath) | |
290 | { | |
291 | $this->bannerpath = $bannerpath; | |
292 | ||
293 | return $this; | |
294 | } | |
295 | ||
296 | /** | |
297 | * Get bannerpath | |
298 | * | |
299 | * @return string | |
300 | */ | |
301 | public function getBannerpath() | |
302 | { | |
303 | return $this->bannerpath; | |
304 | } | |
305 | ||
306 | /** | |
307 | * Set modified | |
308 | * | |
309 | * @param \DateTime $modified | |
310 | * @return Package | |
311 | */ | |
312 | public function setModified($modified) | |
313 | { | |
314 | $this->modified = $modified; | |
315 | ||
316 | return $this; | |
317 | } | |
318 | ||
319 | /** | |
320 | * Get modified | |
321 | * | |
322 | * @return \DateTime | |
323 | */ | |
324 | public function getModified() | |
325 | { | |
326 | return $this->modified; | |
327 | } | |
328 | ||
329 | /** | |
330 | * Set language | |
331 | * | |
332 | * @param \Mixstore\StoreBundle\Entity\Language $language | |
333 | * @return Package | |
334 | */ | |
335 | public function setLanguage(\Mixstore\StoreBundle\Entity\Language $language) | |
336 | { | |
337 | $this->language = $language; | |
338 | ||
339 | return $this; | |
340 | } | |
341 | ||
342 | /** | |
343 | * Get language | |
344 | * | |
345 | * @return \Mixstore\StoreBundle\Entity\Language | |
346 | */ | |
347 | public function getLanguage() | |
348 | { | |
349 | return $this->language; | |
350 | } | |
351 | ||
352 | /** | |
353 | * Set created | |
354 | * | |
355 | * @param \DateTime $created | |
356 | * @return Package | |
357 | */ | |
358 | public function setCreated($created) | |
359 | { | |
360 | $this->created = $created; | |
361 | ||
362 | return $this; | |
363 | } | |
364 | ||
365 | /** | |
366 | * Get created | |
367 | * | |
368 | * @return \DateTime | |
369 | */ | |
370 | public function getCreated() | |
371 | { | |
372 | return $this->created; | |
373 | } | |
374 | ||
375 | /** | |
376 | * Set dependencies | |
377 | * | |
378 | * @param string $dependencies | |
379 | * @return Package | |
380 | */ | |
381 | public function setDependencies($dependencies) | |
382 | { | |
383 | $this->dependencies = $dependencies; | |
384 | ||
385 | return $this; | |
386 | } | |
387 | ||
388 | /** | |
389 | * Get dependencies | |
390 | * | |
391 | * @return string | |
392 | */ | |
393 | public function getDependencies() | |
394 | { | |
395 | return $this->dependencies; | |
396 | } | |
397 | } |