]> Raphaël G. Git Repositories - airbundle/commitdiff
Add phone field
authorRaphaël Gertz <git@rapsys.eu>
Thu, 14 Nov 2019 22:41:47 +0000 (23:41 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Thu, 14 Nov 2019 22:43:30 +0000 (23:43 +0100)
Add getRoles method
Set uses

Entity/User.php

index 473fd07e894cf0efd83d0deb5c0a256a98933fe7..bd9f802333f9fb11db38c0598e38f51da4371d07 100644 (file)
@@ -3,7 +3,17 @@
 // src/Rapsys/AirBundle/Entity/User.php
 namespace Rapsys\AirBundle\Entity;
 
-class User extends \Rapsys\UserBundle\Entity\User {
+use Rapsys\AirBundle\Entity\Application;
+use Rapsys\AirBundle\Entity\Group;
+use Rapsys\AirBundle\Entity\Vote;
+use Rapsys\UserBundle\Entity\User as BaseUser;
+
+class User extends BaseUser {
+       /**
+        * @var string
+        */
+       protected $phone;
+
        /**
         * @var \Doctrine\Common\Collections\Collection
         */
@@ -21,6 +31,28 @@ class User extends \Rapsys\UserBundle\Entity\User {
                parent::__construct();
        }
 
+       /**
+        * Set phone
+        *
+        * @param string $phone
+        *
+        * @return User
+        */
+       public function setPhone($phone) {
+               $this->phone = $phone;
+
+               return $this;
+       }
+
+       /**
+        * Get phone
+        *
+        * @return string
+        */
+       public function getPhone() {
+               return $this->phone;
+       }
+
        /**
         * Add vote
         *
@@ -28,7 +60,7 @@ class User extends \Rapsys\UserBundle\Entity\User {
         *
         * @return User
         */
-       public function addVote(\Rapsys\AirBundle\Entity\Vote $vote) {
+       public function addVote(Vote $vote) {
                $this->votes[] = $vote;
 
                return $this;
@@ -39,7 +71,7 @@ class User extends \Rapsys\UserBundle\Entity\User {
         *
         * @param \Rapsys\AirBundle\Entity\Vote $vote
         */
-       public function removeVote(\Rapsys\AirBundle\Entity\Vote $vote) {
+       public function removeVote(Vote $vote) {
                $this->votes->removeElement($vote);
        }
 
@@ -59,7 +91,7 @@ class User extends \Rapsys\UserBundle\Entity\User {
         *
         * @return User
         */
-       public function addApplication(\Rapsys\AirBundle\Entity\Application $application) {
+       public function addApplication(Application $application) {
                $this->applications[] = $application;
 
                return $this;
@@ -70,7 +102,7 @@ class User extends \Rapsys\UserBundle\Entity\User {
         *
         * @param \Rapsys\AirBundle\Entity\Application $application
         */
-       public function removeApplication(\Rapsys\AirBundle\Entity\Application $application) {
+       public function removeApplication(Application $application) {
                $this->applications->removeElement($application);
        }
 
@@ -82,4 +114,15 @@ class User extends \Rapsys\UserBundle\Entity\User {
        public function getApplications() {
                return $this->applications;
        }
+
+       /**
+        * Get roles
+        *
+        * @return array
+        */
+       public function getRoles() {
+               //Return roles array
+               //XXX: [ ROLE_USER, ROLE_XXX, ... ]
+               return parent::getRoles();
+       }
 }