]> Raphaƫl G. Git Repositories - airbundle/blob - Entity/Snippet.php
Add fetchAllByDatePeriod function
[airbundle] / Entity / Snippet.php
1 <?php
2
3 namespace Rapsys\AirBundle\Entity;
4
5 use Rapsys\AirBundle\Entity\Location;
6 use Rapsys\AirBundle\Entity\User;
7
8 /**
9 * Snippet
10 */
11 class Snippet {
12 /**
13 * @var integer
14 */
15 private $id;
16
17 /**
18 * @var string
19 */
20 protected $locale;
21
22 /**
23 * @var string
24 */
25 protected $description;
26
27 /**
28 * @var string
29 */
30 protected $class;
31
32 /**
33 * @var string
34 */
35 protected $contact;
36
37 /**
38 * @var string
39 */
40 protected $donate;
41
42 /**
43 * @var string
44 */
45 protected $link;
46
47 /**
48 * @var string
49 */
50 protected $profile;
51
52 /**
53 * @var \DateTime
54 */
55 protected $created;
56
57 /**
58 * @var \DateTime
59 */
60 protected $updated;
61
62 /**
63 * @var \Rapsys\UserBundle\Entity\Location
64 */
65 protected $location;
66
67 /**
68 * @var \Rapsys\UserBundle\Entity\User
69 */
70 protected $user;
71
72 /**
73 * Get id
74 *
75 * @return integer
76 */
77 public function getId() {
78 return $this->id;
79 }
80
81 /**
82 * Set locale
83 *
84 * @param string $locale
85 *
86 * @return Snippet
87 */
88 public function setLocale($locale) {
89 $this->locale = $locale;
90
91 return $this;
92 }
93
94 /**
95 * Get locale
96 *
97 * @return string
98 */
99 public function getLocale() {
100 return $this->locale;
101 }
102
103 /**
104 * Set description
105 *
106 * @param string $description
107 *
108 * @return Snippet
109 */
110 public function setDescription($description) {
111 $this->description = $description;
112
113 return $this;
114 }
115
116 /**
117 * Get description
118 *
119 * @return string
120 */
121 public function getDescription() {
122 return $this->description;
123 }
124
125 /**
126 * Set class
127 *
128 * @param string $class
129 *
130 * @return Snippet
131 */
132 public function setClass($class) {
133 $this->class = $class;
134
135 return $this;
136 }
137
138 /**
139 * Get class
140 *
141 * @return string
142 */
143 public function getClass() {
144 return $this->class;
145 }
146
147 /**
148 * Set contact
149 *
150 * @param string $contact
151 *
152 * @return Snippet
153 */
154 public function setContact($contact) {
155 $this->contact = $contact;
156
157 return $this;
158 }
159
160 /**
161 * Get contact
162 *
163 * @return string
164 */
165 public function getContact() {
166 return $this->contact;
167 }
168
169 /**
170 * Set donate
171 *
172 * @param string $donate
173 *
174 * @return Snippet
175 */
176 public function setDonate($donate) {
177 $this->donate = $donate;
178
179 return $this;
180 }
181
182 /**
183 * Get donate
184 *
185 * @return string
186 */
187 public function getDonate() {
188 return $this->donate;
189 }
190
191 /**
192 * Set link
193 *
194 * @param string $link
195 *
196 * @return Snippet
197 */
198 public function setLink($link) {
199 $this->link = $link;
200
201 return $this;
202 }
203
204 /**
205 * Get link
206 *
207 * @return string
208 */
209 public function getLink() {
210 return $this->link;
211 }
212
213 /**
214 * Set profile
215 *
216 * @param string $profile
217 *
218 * @return Snippet
219 */
220 public function setProfile($profile) {
221 $this->profile = $profile;
222
223 return $this;
224 }
225
226 /**
227 * Get profile
228 *
229 * @return string
230 */
231 public function getProfile() {
232 return $this->profile;
233 }
234
235 /**
236 * Set created
237 *
238 * @param \DateTime $created
239 *
240 * @return Snippet
241 */
242 public function setCreated($created) {
243 $this->created = $created;
244
245 return $this;
246 }
247
248 /**
249 * Get created
250 *
251 * @return \DateTime
252 */
253 public function getCreated() {
254 return $this->created;
255 }
256
257 /**
258 * Set updated
259 *
260 * @param \DateTime $updated
261 *
262 * @return Snippet
263 */
264 public function setUpdated($updated) {
265 $this->updated = $updated;
266
267 return $this;
268 }
269
270 /**
271 * Get updated
272 *
273 * @return \DateTime
274 */
275 public function getUpdated() {
276 return $this->updated;
277 }
278
279 /**
280 * Set location
281 *
282 * @param Location $location
283 *
284 * @return Snippet
285 */
286 public function setLocation(Location $location) {
287 $this->location = $location;
288
289 return $this;
290 }
291
292 /**
293 * Get location
294 *
295 * @return Location
296 */
297 public function getLocation() {
298 return $this->location;
299 }
300
301 /**
302 * Set user
303 *
304 * @param User $user
305 *
306 * @return Snippet
307 */
308 public function setUser(User $user) {
309 $this->user = $user;
310
311 return $this;
312 }
313
314 /**
315 * Get user
316 *
317 * @return User
318 */
319 public function getUser() {
320 return $this->user;
321 }
322
323 /**
324 * {@inheritdoc}
325 */
326 public function preUpdate(\Doctrine\ORM\Event\PreUpdateEventArgs $eventArgs) {
327 //Check that we have an snippet instance
328 if (($snippet = $eventArgs->getEntity()) instanceof Snippet) {
329 //Set updated value
330 $snippet->setUpdated(new \DateTime('now'));
331 }
332 }
333 }