]> Raphaƫl G. Git Repositories - airbundle/blob - Entity/User.php
Add required context for template
[airbundle] / Entity / User.php
1 <?php
2
3 // src/Rapsys/AirBundle/Entity/User.php
4 namespace Rapsys\AirBundle\Entity;
5
6 use Rapsys\AirBundle\Entity\Application;
7 use Rapsys\AirBundle\Entity\Group;
8 use Rapsys\AirBundle\Entity\Vote;
9 use Rapsys\UserBundle\Entity\User as BaseUser;
10
11 class User extends BaseUser {
12 /**
13 * @var string
14 */
15 protected $phone;
16
17 /**
18 * @var \Doctrine\Common\Collections\Collection
19 */
20 private $votes;
21
22 /**
23 * @var \Doctrine\Common\Collections\Collection
24 */
25 private $applications;
26
27 /**
28 * Constructor
29 */
30 public function __construct() {
31 parent::__construct();
32 }
33
34 /**
35 * Set phone
36 *
37 * @param string $phone
38 *
39 * @return User
40 */
41 public function setPhone($phone) {
42 $this->phone = $phone;
43
44 return $this;
45 }
46
47 /**
48 * Get phone
49 *
50 * @return string
51 */
52 public function getPhone() {
53 return $this->phone;
54 }
55
56 /**
57 * Add vote
58 *
59 * @param \Rapsys\AirBundle\Entity\Vote $vote
60 *
61 * @return User
62 */
63 public function addVote(Vote $vote) {
64 $this->votes[] = $vote;
65
66 return $this;
67 }
68
69 /**
70 * Remove vote
71 *
72 * @param \Rapsys\AirBundle\Entity\Vote $vote
73 */
74 public function removeVote(Vote $vote) {
75 $this->votes->removeElement($vote);
76 }
77
78 /**
79 * Get votes
80 *
81 * @return \Doctrine\Common\Collections\Collection
82 */
83 public function getVotes() {
84 return $this->votes;
85 }
86
87 /**
88 * Add application
89 *
90 * @param \Rapsys\AirBundle\Entity\Application $application
91 *
92 * @return User
93 */
94 public function addApplication(Application $application) {
95 $this->applications[] = $application;
96
97 return $this;
98 }
99
100 /**
101 * Remove application
102 *
103 * @param \Rapsys\AirBundle\Entity\Application $application
104 */
105 public function removeApplication(Application $application) {
106 $this->applications->removeElement($application);
107 }
108
109 /**
110 * Get applications
111 *
112 * @return \Doctrine\Common\Collections\Collection
113 */
114 public function getApplications() {
115 return $this->applications;
116 }
117
118 /**
119 * Get roles
120 *
121 * @return array
122 */
123 public function getRoles() {
124 //Return roles array
125 //XXX: [ ROLE_USER, ROLE_XXX, ... ]
126 return parent::getRoles();
127 }
128 }