1 | <?php |
||
16 | class User |
||
17 | { |
||
18 | /** |
||
19 | * @var int |
||
20 | * |
||
21 | * @ORM\Column(name="id", type="integer") |
||
22 | * @ORM\Id |
||
23 | * @ORM\GeneratedValue(strategy="AUTO") |
||
24 | */ |
||
25 | private $id; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | * |
||
30 | * @ORM\Column(name="name", type="string", length=50, unique=true) |
||
31 | * |
||
32 | * @Assert\NotBlank() |
||
33 | * @Assert\Length(max = 50) |
||
34 | */ |
||
35 | private $name; |
||
36 | |||
37 | /** |
||
38 | * @var string |
||
39 | * |
||
40 | * @Gedmo\Slug(fields={"name"}, updatable=true, separator="_") |
||
41 | * @ORM\Column(name="slug", type="string", length=50, unique=true) |
||
42 | * |
||
43 | * @Assert\NotBlank() |
||
44 | * @Assert\Length(max = 50) |
||
45 | */ |
||
46 | private $slug; |
||
47 | |||
48 | /** |
||
49 | * @var string |
||
50 | * |
||
51 | * @ORM\Column(name="photo", type="string", length=150, nullable=true) |
||
52 | * |
||
53 | * @Assert\Length(max = 150) |
||
54 | */ |
||
55 | private $photo; |
||
56 | |||
57 | /** |
||
58 | * @var string |
||
59 | * |
||
60 | * @ORM\Column(name="email", type="string", length=50) |
||
61 | * |
||
62 | * @Assert\NotBlank() |
||
63 | * @Assert\Email() |
||
64 | */ |
||
65 | private $email; |
||
66 | |||
67 | /** |
||
68 | * @var string |
||
69 | * |
||
70 | * @ORM\Column(name="password", type="string", length=100) |
||
71 | * |
||
72 | * @Assert\NotBlank() |
||
73 | * @Assert\Length(max = 100) |
||
74 | */ |
||
75 | private $password; |
||
76 | |||
77 | /** |
||
78 | * @ORM\OneToMany(targetEntity="Article", mappedBy="user") |
||
79 | */ |
||
80 | private $articles; |
||
81 | |||
82 | /** |
||
83 | * @ORM\OneToMany(targetEntity="Comment", mappedBy="user") |
||
84 | */ |
||
85 | private $comments; |
||
86 | |||
87 | /** |
||
88 | * @ORM\ManyToOne(targetEntity="Role", inversedBy="users") |
||
89 | * @ORM\JoinColumn(name="role_id", referencedColumnName="id") |
||
90 | */ |
||
91 | private $role; |
||
92 | |||
93 | /** |
||
94 | * @var \DateTime |
||
95 | * |
||
96 | * @Gedmo\Timestampable(on="create") |
||
97 | * @ORM\Column(name="created_at", type="datetime") |
||
98 | * |
||
99 | * @Assert\DateTime() |
||
100 | */ |
||
101 | private $createdAt; |
||
102 | |||
103 | /** |
||
104 | * @var \DateTime |
||
105 | * |
||
106 | * @Gedmo\Timestampable(on="change", field={"user", "role", "email", "password"}) |
||
107 | * @ORM\Column(name="updated_at", type="datetime", nullable=true) |
||
108 | * |
||
109 | * @Assert\DateTime() |
||
110 | */ |
||
111 | private $updatedAt; |
||
112 | |||
113 | /** |
||
114 | * @var \DateTime |
||
115 | * |
||
116 | * @ORM\Column(name="deleted_at", type="datetime", nullable=true) |
||
117 | * |
||
118 | * @Assert\DateTime() |
||
119 | */ |
||
120 | private $deletedAt; |
||
121 | |||
122 | |||
123 | /** |
||
124 | * Get id |
||
125 | * |
||
126 | * @return int |
||
127 | */ |
||
128 | public function getId() |
||
129 | { |
||
130 | return $this->id; |
||
131 | } |
||
132 | |||
133 | /** |
||
134 | * Set user |
||
135 | * |
||
136 | * @param string $name |
||
137 | * |
||
138 | * @return User |
||
139 | */ |
||
140 | public function setName($name) |
||
146 | |||
147 | /** |
||
148 | * Get user |
||
149 | * |
||
150 | * @return string |
||
151 | */ |
||
152 | 7 | public function getName() |
|
156 | |||
157 | /** |
||
158 | * Set slug |
||
159 | * |
||
160 | * @param string $slug |
||
161 | * |
||
162 | * @return User |
||
163 | */ |
||
164 | public function setSlug($slug) |
||
170 | |||
171 | /** |
||
172 | * Get slug |
||
173 | * |
||
174 | * @return string |
||
175 | */ |
||
176 | 6 | public function getSlug() |
|
180 | |||
181 | /** |
||
182 | * Set email |
||
183 | * |
||
184 | * @param string $email |
||
185 | * |
||
186 | * @return User |
||
187 | */ |
||
188 | public function setEmail($email) |
||
189 | { |
||
190 | $this->email = $email; |
||
191 | |||
192 | return $this; |
||
193 | } |
||
194 | |||
195 | /** |
||
196 | * Get email |
||
197 | * |
||
198 | * @return string |
||
199 | */ |
||
200 | public function getEmail() |
||
204 | |||
205 | /** |
||
206 | * Set createdAt |
||
207 | * |
||
208 | * @param \DateTime $createdAt |
||
209 | * |
||
210 | * @return User |
||
211 | */ |
||
212 | public function setCreatedAt($createdAt) |
||
218 | |||
219 | /** |
||
220 | * Get createdAt |
||
221 | * |
||
222 | * @return \DateTime |
||
223 | */ |
||
224 | public function getCreatedAt() |
||
228 | |||
229 | /** |
||
230 | * Set updatedAt |
||
231 | * |
||
232 | * @param \DateTime $updatedAt |
||
233 | * |
||
234 | * @return User |
||
235 | */ |
||
236 | public function setUpdatedAt($updatedAt) |
||
242 | |||
243 | /** |
||
244 | * Get updatedAt |
||
245 | * |
||
246 | * @return \DateTime |
||
247 | */ |
||
248 | public function getUpdatedAt() |
||
252 | |||
253 | /** |
||
254 | * Set deletedAt |
||
255 | * |
||
256 | * @param \DateTime $deletedAt |
||
257 | * |
||
258 | * @return User |
||
259 | */ |
||
260 | public function setDeletedAt($deletedAt) |
||
266 | |||
267 | /** |
||
268 | * Get deletedAt |
||
269 | * |
||
270 | * @return \DateTime |
||
271 | */ |
||
272 | public function getDeletedAt() |
||
276 | /** |
||
277 | * Constructor |
||
278 | */ |
||
279 | public function __construct() |
||
284 | |||
285 | /** |
||
286 | * Add article |
||
287 | * |
||
288 | * @param \AppBundle\Entity\Article $article |
||
289 | * |
||
290 | * @return User |
||
291 | */ |
||
292 | public function addArticle(Article $article) |
||
298 | |||
299 | /** |
||
300 | * Remove article |
||
301 | * |
||
302 | * @param \AppBundle\Entity\Article $article |
||
303 | */ |
||
304 | public function removeArticle(Article $article) |
||
308 | |||
309 | /** |
||
310 | * Get articles |
||
311 | * |
||
312 | * @return \Doctrine\Common\Collections\Collection |
||
313 | */ |
||
314 | public function getArticles() |
||
318 | |||
319 | /** |
||
320 | * Add comment |
||
321 | * |
||
322 | * @param \AppBundle\Entity\Comment $comment |
||
323 | * |
||
324 | * @return User |
||
325 | */ |
||
326 | public function addComment(Comment $comment) |
||
332 | |||
333 | /** |
||
334 | * Remove comment |
||
335 | * |
||
336 | * @param \AppBundle\Entity\Comment $comment |
||
337 | */ |
||
338 | public function removeComment(Comment $comment) |
||
342 | |||
343 | /** |
||
344 | * Get comments |
||
345 | * |
||
346 | * @return \Doctrine\Common\Collections\Collection |
||
347 | */ |
||
348 | public function getComments() |
||
352 | |||
353 | /** |
||
354 | * Set role |
||
355 | * |
||
356 | * @param \AppBundle\Entity\Role $role |
||
357 | * |
||
358 | * @return User |
||
359 | */ |
||
360 | public function setRole(Role $role = null) |
||
366 | |||
367 | /** |
||
368 | * Get role |
||
369 | * |
||
370 | * @return \AppBundle\Entity\Role |
||
371 | */ |
||
372 | public function getRole() |
||
376 | |||
377 | /** |
||
378 | * Set password |
||
379 | * |
||
380 | * @param string $password |
||
381 | * |
||
382 | * @return User |
||
383 | */ |
||
384 | public function setPassword($password) |
||
390 | |||
391 | /** |
||
392 | * Get password |
||
393 | * |
||
394 | * @return string |
||
395 | */ |
||
396 | public function getPassword() |
||
400 | |||
401 | /** |
||
402 | * Set photo |
||
403 | * |
||
404 | * @param string $photo |
||
405 | * |
||
406 | * @return User |
||
407 | */ |
||
408 | public function setPhoto($photo) |
||
414 | |||
415 | /** |
||
416 | * Get photo |
||
417 | * |
||
418 | * @return string |
||
419 | */ |
||
420 | 6 | public function getPhoto() |
|
424 | } |
||
425 |