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\Civility
;
18 use Rapsys\UserBundle\Entity\User
as BaseUser
;
20 class User
extends BaseUser
{
24 private ?string $city;
29 private ?string $phone;
34 private ?Country
$country;
39 private ?string $pseudonym;
44 private ?string $zipcode;
47 * @var \Doctrine\Common\Collections\Collection
49 private Collection
$applications;
52 * @var \Doctrine\Common\Collections\Collection
54 private Collection
$dances;
57 * @var \Doctrine\Common\Collections\Collection
59 private Collection
$locations;
62 * @var \Doctrine\Common\Collections\Collection
64 private Collection
$snippets;
67 * @var \Doctrine\Common\Collections\Collection
69 private Collection
$subscribers;
72 * @var \Doctrine\Common\Collections\Collection
74 private Collection
$subscriptions;
77 * @var \Doctrine\Common\Collections\Collection
79 private Collection
$googleTokens;
84 * @param string $mail The user mail
85 * @param string $password The user password
86 * @param ?Civility $civility The user civility
87 * @param ?string $forename The user forename
88 * @param ?string $surname The user surname
89 * @param bool $active The user active
90 * @param bool $enable The user enable
92 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) {
93 //Call parent constructor
94 parent
::__construct($this->mail
, $this->password
, $this->civility
, $this->forename
, $this->surname
, $this->active
, $this->enable
);
98 $this->country
= null;
100 $this->pseudonym
= null;
101 $this->zipcode
= null;
104 $this->applications
= new ArrayCollection();
105 $this->dances
= new ArrayCollection();
106 $this->locations
= new ArrayCollection();
107 $this->snippets
= new ArrayCollection();
108 $this->subscribers
= new ArrayCollection();
109 $this->subscriptions
= new ArrayCollection();
110 $this->googleTokens
= new ArrayCollection();
116 * @param string $city
120 public function setCity(?string $city): User
{
131 public function getCity(): ?string {
138 * @param Country $country
142 public function setCountry(?Country
$country): User
{
143 $this->country
= $country;
153 public function getCountry(): ?Country
{
154 return $this->country
;
160 * @param string $phone
164 public function setPhone(?string $phone): User
{
165 $this->phone
= $phone;
175 public function getPhone(): ?string {
182 * @param string $pseudonym
186 public function setPseudonym(?string $pseudonym): User
{
187 $this->pseudonym
= $pseudonym;
197 public function getPseudonym(): ?string {
198 return $this->pseudonym
;
204 * @param string $zipcode
208 public function setZipcode(?string $zipcode): User
{
209 $this->zipcode
= $zipcode;
219 public function getZipcode(): ?string {
220 return $this->zipcode
;
226 * @param Application $application
230 public function addApplication(Application
$application): User
{
231 $this->applications
[] = $application;
239 * @param Application $application
241 public function removeApplication(Application
$application): bool {
242 return $this->applications
->removeElement($application);
248 * @return \Doctrine\Common\Collections\Collection
250 public function getApplications(): Collection
{
251 return $this->applications
;
257 * @param Dance $dance
261 public function addDance(Dance
$dance): User
{
262 $this->dances
[] = $dance;
270 * @param Dance $dance
274 public function removeDance(Dance
$dance): bool {
275 return $this->dances
->removeElement($dance);
281 * @return \Doctrine\Common\Collections\Collection
283 public function getDances(): Collection
{
284 return $this->dances
;
290 * @param Location $location
294 public function addLocation(Location
$location): User
{
295 $this->locations
[] = $location;
303 * @param Location $location
305 public function removeLocation(Location
$location): bool {
306 return $this->locations
->removeElement($location);
312 * @return \Doctrine\Common\Collections\Collection
314 public function getLocations(): Collection
{
315 return $this->locations
;
321 * @param Snippet $snippet
325 public function addSnippet(Snippet
$snippet): User
{
326 $this->snippets
[] = $snippet;
334 * @param Snippet $snippet
336 public function removeSnippet(Snippet
$snippet): bool {
337 return $this->snippets
->removeElement($snippet);
343 * @return \Doctrine\Common\Collections\Collection
345 public function getSnippets(): Collection
{
346 return $this->snippets
;
352 * @param User $subscriber
356 public function addSubscriber(User
$subscriber): User
{
357 //Add from owning side
358 $subscriber->addSubscription($this);
360 $this->subscribers
[] = $subscriber;
368 * @param User $subscriber
370 public function removeSubscriber(User
$subscriber): bool {
371 if (!$this->subscriptions
->contains($subscriber)) {
375 //Remove from owning side
376 $subscriber->removeSubscription($this);
378 return $this->subscribers
->removeElement($subscriber);
384 * @return \Doctrine\Common\Collections\Collection
386 public function getSubscribers(): Collection
{
387 return $this->subscribers
;
393 * @param User $subscription
397 public function addSubscription(User
$subscription): User
{
398 $this->subscriptions
[] = $subscription;
404 * Remove subscription
406 * @param User $subscription
408 public function removeSubscription(User
$subscription): bool {
409 return $this->subscriptions
->removeElement($subscription);
415 * @return \Doctrine\Common\Collections\Collection
417 public function getSubscriptions(): Collection
{
418 return $this->subscriptions
;
424 * @param GoogleToken $googleToken
428 public function addGoogleToken(GoogleToken
$googleToken): User
{
429 $this->googleTokens
[] = $googleToken;
435 * Remove google token
437 * @param GoogleToken $googleToken
439 public function removeGoogleToken(GoogleToken
$googleToken): bool {
440 return $this->googleTokens
->removeElement($googleToken);
446 * @return \Doctrine\Common\Collections\Collection
448 public function getGoogleTokens(): Collection
{
449 return $this->googleTokens
;