1 <?php
declare(strict_types
=1);
4 * This file is part of the Rapsys AirBundle 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\Civility
;
18 use Rapsys\UserBundle\Entity\User
as BaseUser
;
23 class User
extends BaseUser
{
27 private ?string $city = null;
32 private ?Country
$country = null;
37 private ?string $phone = null;
42 private ?string $pseudonym = null;
47 private ?string $zipcode = null;
52 private ?string $mid = null;
57 private ?string $mip = null;
60 * Applications collection
62 private Collection
$applications;
67 private Collection
$dances;
70 * Locations collection
72 private Collection
$locations;
77 private Collection
$snippets;
80 * Subscribers collection
82 private Collection
$subscribers;
85 * Subscriptions collection
87 private Collection
$subscriptions;
90 * Google tokens collection
92 private Collection
$googleTokens;
97 * @param string $mail The user mail
98 * @param string $password The user password
99 * @param ?Civility $civility The user civility
100 * @param ?string $forename The user forename
101 * @param ?string $surname The user surname
102 * @param bool $active The user active
103 * @param bool $enable The user enable
105 public function __construct(protected string $mail, protected string $password, protected ?Civility
$civility = null, protected ?string $forename = null, protected ?string $surname = null, protected bool $active = false, protected bool $enable = true) {
106 //Call parent constructor
107 parent
::__construct($this->mail
, $this->password
, $this->civility
, $this->forename
, $this->surname
, $this->active
, $this->enable
);
110 $this->applications
= new ArrayCollection();
111 $this->dances
= new ArrayCollection();
112 $this->locations
= new ArrayCollection();
113 $this->snippets
= new ArrayCollection();
114 $this->subscribers
= new ArrayCollection();
115 $this->subscriptions
= new ArrayCollection();
116 $this->googleTokens
= new ArrayCollection();
122 * @param string $city
126 public function setCity(?string $city): User
{
137 public function getCity(): ?string {
144 * @param Country $country
148 public function setCountry(?Country
$country): User
{
149 $this->country
= $country;
159 public function getCountry(): ?Country
{
160 return $this->country
;
166 * @param string $phone
170 public function setPhone(?string $phone): User
{
171 $this->phone
= $phone;
181 public function getPhone(): ?string {
188 * @param string $pseudonym
192 public function setPseudonym(?string $pseudonym): User
{
193 $this->pseudonym
= $pseudonym;
203 public function getPseudonym(): ?string {
204 return $this->pseudonym
;
210 * @param string $zipcode
214 public function setZipcode(?string $zipcode): User
{
215 $this->zipcode
= $zipcode;
225 public function getZipcode(): ?string {
226 return $this->zipcode
;
236 public function setMid(?string $mid): User
{
247 public function getMid(): ?string {
258 public function setMip(?string $mip): User
{
269 public function getMip(): ?string {
276 * @param Application $application
280 public function addApplication(Application
$application): User
{
281 $this->applications
[] = $application;
289 * @param Application $application
291 public function removeApplication(Application
$application): bool {
292 return $this->applications
->removeElement($application);
298 * @return \Doctrine\Common\Collections\Collection
300 public function getApplications(): Collection
{
301 return $this->applications
;
307 * @param Dance $dance
311 public function addDance(Dance
$dance): User
{
312 $this->dances
[] = $dance;
320 * @param Dance $dance
324 public function removeDance(Dance
$dance): bool {
325 return $this->dances
->removeElement($dance);
331 * @return \Doctrine\Common\Collections\Collection
333 public function getDances(): Collection
{
334 return $this->dances
;
340 * @param Location $location
344 public function addLocation(Location
$location): User
{
345 $this->locations
[] = $location;
353 * @param Location $location
355 public function removeLocation(Location
$location): bool {
356 return $this->locations
->removeElement($location);
362 * @return \Doctrine\Common\Collections\Collection
364 public function getLocations(): Collection
{
365 return $this->locations
;
371 * @param Snippet $snippet
375 public function addSnippet(Snippet
$snippet): User
{
376 $this->snippets
[] = $snippet;
384 * @param Snippet $snippet
386 public function removeSnippet(Snippet
$snippet): bool {
387 return $this->snippets
->removeElement($snippet);
393 * @return \Doctrine\Common\Collections\Collection
395 public function getSnippets(): Collection
{
396 return $this->snippets
;
402 * @param User $subscriber
406 public function addSubscriber(User
$subscriber): User
{
407 //Add from owning side
408 $subscriber->addSubscription($this);
410 $this->subscribers
[] = $subscriber;
418 * @param User $subscriber
420 public function removeSubscriber(User
$subscriber): bool {
421 if (!$this->subscriptions
->contains($subscriber)) {
425 //Remove from owning side
426 $subscriber->removeSubscription($this);
428 return $this->subscribers
->removeElement($subscriber);
434 * @return \Doctrine\Common\Collections\Collection
436 public function getSubscribers(): Collection
{
437 return $this->subscribers
;
443 * @param User $subscription
447 public function addSubscription(User
$subscription): User
{
448 $this->subscriptions
[] = $subscription;
454 * Remove subscription
456 * @param User $subscription
458 public function removeSubscription(User
$subscription): bool {
459 return $this->subscriptions
->removeElement($subscription);
465 * @return \Doctrine\Common\Collections\Collection
467 public function getSubscriptions(): Collection
{
468 return $this->subscriptions
;
474 * @param GoogleToken $googleToken
478 public function addGoogleToken(GoogleToken
$googleToken): User
{
479 $this->googleTokens
[] = $googleToken;
485 * Remove google token
487 * @param GoogleToken $googleToken
489 public function removeGoogleToken(GoogleToken
$googleToken): bool {
490 return $this->googleTokens
->removeElement($googleToken);
496 * @return \Doctrine\Common\Collections\Collection
498 public function getGoogleTokens(): Collection
{
499 return $this->googleTokens
;