]> Raphaƫl G. Git Repositories - airbundle/blobdiff - Entity/User.php
Retrieve session snippet rate and hat fields
[airbundle] / Entity / User.php
index bd9f802333f9fb11db38c0598e38f51da4371d07..22bf46da496d7298ff95163b1258a6e10567bdd4 100644 (file)
@@ -5,7 +5,8 @@ namespace Rapsys\AirBundle\Entity;
 
 use Rapsys\AirBundle\Entity\Application;
 use Rapsys\AirBundle\Entity\Group;
-use Rapsys\AirBundle\Entity\Vote;
+use Rapsys\AirBundle\Entity\Link;
+use Rapsys\AirBundle\Entity\Snippet;
 use Rapsys\UserBundle\Entity\User as BaseUser;
 
 class User extends BaseUser {
@@ -17,18 +18,43 @@ class User extends BaseUser {
        /**
         * @var \Doctrine\Common\Collections\Collection
         */
-       private $votes;
+       private $applications;
 
        /**
         * @var \Doctrine\Common\Collections\Collection
         */
-       private $applications;
+       private $locations;
+
+       /**
+        * @var \Doctrine\Common\Collections\Collection
+        */
+       private $snippets;
+
+       /**
+        * @var \Doctrine\Common\Collections\Collection
+        */
+       private $subscribers;
+
+       /**
+        * @var \Doctrine\Common\Collections\Collection
+        */
+       private $subscriptions;
 
        /**
         * Constructor
+        *
+        * @param string $mail The user mail
         */
-       public function __construct() {
-               parent::__construct();
+       public function __construct(string $mail) {
+               //Call parent constructor
+               parent::__construct($mail);
+
+               //Set collections
+               $this->applications = new \Doctrine\Common\Collections\ArrayCollection();
+               $this->locations = new \Doctrine\Common\Collections\ArrayCollection();
+               $this->snippets = new \Doctrine\Common\Collections\ArrayCollection();
+               $this->subscribers = new \Doctrine\Common\Collections\ArrayCollection();
+               $this->subscriptions = new \Doctrine\Common\Collections\ArrayCollection();
        }
 
        /**
@@ -54,34 +80,47 @@ class User extends BaseUser {
        }
 
        /**
-        * Add vote
+        * Set donation
         *
-        * @param \Rapsys\AirBundle\Entity\Vote $vote
+        * @param string $donation
         *
         * @return User
         */
-       public function addVote(Vote $vote) {
-               $this->votes[] = $vote;
+       public function setDonation($donation) {
+               $this->donation = $donation;
 
                return $this;
        }
 
        /**
-        * Remove vote
+        * Get donation
         *
-        * @param \Rapsys\AirBundle\Entity\Vote $vote
+        * @return string
         */
-       public function removeVote(Vote $vote) {
-               $this->votes->removeElement($vote);
+       public function getDonation() {
+               return $this->donation;
        }
 
        /**
-        * Get votes
+        * Set site
         *
-        * @return \Doctrine\Common\Collections\Collection
+        * @param string $site
+        *
+        * @return User
+        */
+       public function setSite($site) {
+               $this->site = $site;
+
+               return $this;
+       }
+
+       /**
+        * Get site
+        *
+        * @return string
         */
-       public function getVotes() {
-               return $this->votes;
+       public function getSite() {
+               return $this->site;
        }
 
        /**
@@ -116,13 +155,126 @@ class User extends BaseUser {
        }
 
        /**
-        * Get roles
+        * Add snippet
+        *
+        * @param \Rapsys\AirBundle\Entity\Snippet $snippet
+        *
+        * @return User
+        */
+       public function addSnippet(Snippet $snippet) {
+               $this->snippets[] = $snippet;
+
+               return $this;
+       }
+
+       /**
+        * Remove snippet
+        *
+        * @param \Rapsys\AirBundle\Entity\Snippet $snippet
+        */
+       public function removeSnippet(Snippet $snippet) {
+               $this->snippets->removeElement($snippet);
+       }
+
+       /**
+        * Get snippets
         *
-        * @return array
+        * @return \Doctrine\Common\Collections\Collection
+        */
+       public function getSnippets() {
+               return $this->snippets;
+       }
+
+       /**
+        * Add location
+        *
+        * @param \Rapsys\AirBundle\Entity\Location $location
+        *
+        * @return User
+        */
+       public function addLocation(Location $location) {
+               $this->locations[] = $location;
+
+               return $this;
+       }
+
+       /**
+        * Remove location
+        *
+        * @param \Rapsys\AirBundle\Entity\Location $location
+        */
+       public function removeLocation(Location $location) {
+               $this->locations->removeElement($location);
+       }
+
+       /**
+        * Get locations
+        *
+        * @return \Doctrine\Common\Collections\Collection
+        */
+       public function getLocations() {
+               return $this->locations;
+       }
+
+       /**
+        * Add subscriber
+        *
+        * @param \Rapsys\AirBundle\Entity\User $subscriber
+        *
+        * @return User
+        */
+       public function addSubscriber(User $subscriber) {
+               $this->subscribers[] = $subscriber;
+
+               return $this;
+       }
+
+       /**
+        * Remove subscriber
+        *
+        * @param \Rapsys\AirBundle\Entity\User $subscriber
+        */
+       public function removeSubscriber(User $subscriber) {
+               $this->subscribers->removeElement($subscriber);
+       }
+
+       /**
+        * Get subscribers
+        *
+        * @return \Doctrine\Common\Collections\Collection
+        */
+       public function getSubscribers() {
+               return $this->subscribers;
+       }
+
+       /**
+        * Add subscription
+        *
+        * @param \Rapsys\AirBundle\Entity\User $subscription
+        *
+        * @return User
+        */
+       public function addSubscription(User $subscription) {
+               $this->subscriptions[] = $subscription;
+
+               return $this;
+       }
+
+       /**
+        * Remove subscription
+        *
+        * @param \Rapsys\AirBundle\Entity\User $subscription
+        */
+       public function removeSubscription(User $subscription) {
+               $this->subscriptions->removeElement($subscription);
+       }
+
+       /**
+        * Get subscriptions
+        *
+        * @return \Doctrine\Common\Collections\Collection
         */
-       public function getRoles() {
-               //Return roles array
-               //XXX: [ ROLE_USER, ROLE_XXX, ... ]
-               return parent::getRoles();
+       public function getSubscriptions() {
+               return $this->subscriptions;
        }
 }