1 <?php
declare(strict_types
=1);
4 * this file is part of the rapsys packbundle package.
6 * (c) raphaël gertz <symfony@rapsys.eu>
8 * for the full copyright and license information, please view the license
9 * file that was distributed with this source code.
12 namespace Rapsys\AirBundle\Entity
;
14 use Doctrine\Common\Collections\Collection
;
15 use Doctrine\Common\Collections\ArrayCollection
;
17 use Rapsys\UserBundle\Entity\User
as BaseUser
;
19 class User
extends BaseUser
{
23 private ?string $city;
28 private ?string $phone;
33 private ?Country
$country;
38 private ?string $pseudonym;
43 private ?string $zipcode;
46 * @var \Doctrine\Common\Collections\Collection
48 private Collection
$applications;
51 * @var \Doctrine\Common\Collections\Collection
53 private Collection
$dances;
56 * @var \Doctrine\Common\Collections\Collection
58 private Collection
$locations;
61 * @var \Doctrine\Common\Collections\Collection
63 private Collection
$snippets;
66 * @var \Doctrine\Common\Collections\Collection
68 private Collection
$subscribers;
71 * @var \Doctrine\Common\Collections\Collection
73 private Collection
$subscriptions;
76 * @var \Doctrine\Common\Collections\Collection
78 private Collection
$googleTokens;
83 * @param string $mail The user mail
85 public function __construct(string $mail) {
86 //Call parent constructor
87 parent
::__construct($mail);
91 $this->country
= null;
93 $this->pseudonym
= null;
94 $this->zipcode
= null;
97 $this->applications
= new ArrayCollection();
98 $this->dances
= new ArrayCollection();
99 $this->locations
= new ArrayCollection();
100 $this->snippets
= new ArrayCollection();
101 $this->subscribers
= new ArrayCollection();
102 $this->subscriptions
= new ArrayCollection();
103 $this->googleTokens
= new ArrayCollection();
109 * @param string $city
113 public function setCity(?string $city): User
{
124 public function getCity(): ?string {
131 * @param Country $country
135 public function setCountry(?Country
$country): User
{
136 $this->country
= $country;
146 public function getCountry(): ?Country
{
147 return $this->country
;
153 * @param string $phone
157 public function setPhone(?string $phone): User
{
158 $this->phone
= $phone;
168 public function getPhone(): ?string {
175 * @param string $pseudonym
179 public function setPseudonym(?string $pseudonym): User
{
180 $this->pseudonym
= $pseudonym;
190 public function getPseudonym(): ?string {
191 return $this->pseudonym
;
197 * @param string $zipcode
201 public function setZipcode(?string $zipcode): User
{
202 $this->zipcode
= $zipcode;
212 public function getZipcode(): ?string {
213 return $this->zipcode
;
219 * @param Application $application
223 public function addApplication(Application
$application): User
{
224 $this->applications
[] = $application;
232 * @param Application $application
234 public function removeApplication(Application
$application): bool {
235 return $this->applications
->removeElement($application);
241 * @return \Doctrine\Common\Collections\Collection
243 public function getApplications(): Collection
{
244 return $this->applications
;
250 * @param Dance $dance
254 public function addDance(Dance
$dance): User
{
255 $this->dances
[] = $dance;
263 * @param Dance $dance
267 public function removeDance(Dance
$dance): bool {
268 return $this->dances
->removeElement($dance);
274 * @return \Doctrine\Common\Collections\Collection
276 public function getDances(): Collection
{
277 return $this->dances
;
283 * @param Location $location
287 public function addLocation(Location
$location): User
{
288 $this->locations
[] = $location;
296 * @param Location $location
298 public function removeLocation(Location
$location): bool {
299 return $this->locations
->removeElement($location);
305 * @return \Doctrine\Common\Collections\Collection
307 public function getLocations(): Collection
{
308 return $this->locations
;
314 * @param Snippet $snippet
318 public function addSnippet(Snippet
$snippet): User
{
319 $this->snippets
[] = $snippet;
327 * @param Snippet $snippet
329 public function removeSnippet(Snippet
$snippet): bool {
330 return $this->snippets
->removeElement($snippet);
336 * @return \Doctrine\Common\Collections\Collection
338 public function getSnippets(): Collection
{
339 return $this->snippets
;
345 * @param User $subscriber
349 public function addSubscriber(User
$subscriber): User
{
350 //Add from owning side
351 $subscriber->addSubscription($this);
353 $this->subscribers
[] = $subscriber;
361 * @param User $subscriber
363 public function removeSubscriber(User
$subscriber): bool {
364 if (!$this->subscriptions
->contains($subscriber)) {
368 //Remove from owning side
369 $subscriber->removeSubscription($this);
371 return $this->subscribers
->removeElement($subscriber);
377 * @return \Doctrine\Common\Collections\Collection
379 public function getSubscribers(): Collection
{
380 return $this->subscribers
;
386 * @param User $subscription
390 public function addSubscription(User
$subscription): User
{
391 $this->subscriptions
[] = $subscription;
397 * Remove subscription
399 * @param User $subscription
401 public function removeSubscription(User
$subscription): bool {
402 return $this->subscriptions
->removeElement($subscription);
408 * @return \Doctrine\Common\Collections\Collection
410 public function getSubscriptions(): Collection
{
411 return $this->subscriptions
;
417 * @param GoogleToken $googleToken
421 public function addGoogleToken(GoogleToken
$googleToken): User
{
422 $this->googleTokens
[] = $googleToken;
428 * Remove google token
430 * @param GoogleToken $googleToken
432 public function removeGoogleToken(GoogleToken
$googleToken): bool {
433 return $this->googleTokens
->removeElement($googleToken);
439 * @return \Doctrine\Common\Collections\Collection
441 public function getGoogleTokens(): Collection
{
442 return $this->googleTokens
;