]> Raphaël G. Git Repositories - airbundle/commitdiff
Remove vote feature
authorRaphaël Gertz <git@rapsys.eu>
Mon, 28 Dec 2020 07:36:33 +0000 (08:36 +0100)
committerRaphaël Gertz <git@rapsys.eu>
Mon, 28 Dec 2020 07:36:33 +0000 (08:36 +0100)
Add snippet and subscription features
Add donation and site field
Add constructor to handle collections
Cleanup

Entity/User.php

index d521bd46e3d2e04f9e0ce2a098064490298d0eb7..fd35891ea950ab872890a53094f9b8b269d2af23 100644 (file)
@@ -15,15 +15,49 @@ class User extends BaseUser {
        protected $phone;
 
        /**
-        * @var \Doctrine\Common\Collections\Collection
+        * @var string
+        */
+       protected $donation;
+
+       /**
+        * @var string
         */
-       private $votes;
+       protected $site;
 
        /**
         * @var \Doctrine\Common\Collections\Collection
         */
        private $applications;
 
+       /**
+        * @var \Doctrine\Common\Collections\Collection
+        */
+       private $subscribers;
+
+       /**
+        * @var \Doctrine\Common\Collections\Collection
+        */
+       private $subscriptions;
+
+       /**
+        * @var \Doctrine\Common\Collections\Collection
+        */
+       private $snippets;
+
+       /**
+        * Constructor
+        */
+       public function __construct() {
+               //Call parent constructor
+               parent::__construct();
+
+               //Set collections
+               $this->applications = new \Doctrine\Common\Collections\ArrayCollection();
+               $this->subscribers = new \Doctrine\Common\Collections\ArrayCollection();
+               $this->subscriptions = new \Doctrine\Common\Collections\ArrayCollection();
+               $this->snippets = new \Doctrine\Common\Collections\ArrayCollection();
+       }
+
        /**
         * Set phone
         *
@@ -47,34 +81,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;
        }
 
        /**
@@ -107,4 +154,97 @@ class User extends BaseUser {
        public function getApplications() {
                return $this->applications;
        }
+
+       /**
+        * 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 getSubscriptions() {
+               return $this->subscriptions;
+       }
+
+       /**
+        * Add snippet
+        *
+        * @param \Rapsys\AirBundle\Entity\Snippet $snippet
+        *
+        * @return Location
+        */
+       public function addSnippet(\Rapsys\AirBundle\Entity\Snippet $snippet) {
+               $this->snippets[] = $snippet;
+
+               return $this;
+       }
+
+       /**
+        * Remove snippet
+        *
+        * @param \Rapsys\AirBundle\Entity\Snippet $snippet
+        */
+       public function removeSnippet(\Rapsys\AirBundle\Entity\Snippet $snippet) {
+               $this->snippets->removeElement($snippet);
+       }
+
+       /**
+        * Get snippets
+        *
+        * @return \Doctrine\Common\Collections\Collection
+        */
+       public function getSnippets() {
+               return $this->snippets;
+       }
 }