src/Entity/User.php line 114

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use ApiPlatform\Core\Annotation\ApiResource;
  4. use ApiPlatform\Core\Annotation\ApiSubresource;
  5. use App\Controller\Api\User\AuthenticationGoogleController;
  6. use App\Controller\Api\User\DeleteUserController;
  7. use App\Controller\Api\User\GetItemController;
  8. use App\Controller\Api\User\MeController;
  9. use App\Controller\Api\User\RefreshTokenController;
  10. use App\Controller\Api\User\RegisterController;
  11. use App\Controller\Api\User\RemoveDeleteRequestController;
  12. use App\Controller\Api\User\ResetPasswordController;
  13. use App\Controller\Api\User\UserCompaniesManagementController;
  14. use App\Repository\UserRepository;
  15. use DateTimeInterface;
  16. use Doctrine\Common\Collections\ArrayCollection;
  17. use Doctrine\Common\Collections\Collection;
  18. use Doctrine\DBAL\Types\Types;
  19. use Doctrine\ORM\Mapping as ORM;
  20. use Gedmo\Timestampable\Traits\TimestampableEntity;
  21. use Lexik\Bundle\JWTAuthenticationBundle\Security\User\JWTUserInterface;
  22. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  23. use Symfony\Component\Security\Core\User\UserInterface;
  24. use Symfony\Component\Serializer\Annotation\Groups;
  25. use Symfony\Component\Validator\Constraints as Assert;
  26. #[ORM\Entity(repositoryClassUserRepository::class)]
  27. #[ApiResource(
  28.     collectionOperations: [
  29.         'register' => [
  30.             'normalization_context' => [
  31.                 'groups' => 'read:user:collection:register',
  32.             ],
  33.             'denormalization_context' => [
  34.                 'groups' => 'write:user:collection:register',
  35.             ],
  36.             'method' => 'POST',
  37.             'path' => '/register',
  38.             'controller' => RegisterController::class,
  39.             'write' => false,
  40.         ],
  41.         'resetPassword' => [
  42.             'method' => 'POST',
  43.             'path' => '/reset-password',
  44.             'controller' => ResetPasswordController::class,
  45.         ],
  46.         "authentication_google" => [
  47.             'method' => 'POST',
  48.             'path' => '/authentication-google',
  49.             'controller' => AuthenticationGoogleController::class,
  50.         ],
  51.         'deleteUser' => [
  52.             'normalization_context' => [
  53.                 'groups' => 'read:user:item:me',
  54.             ],
  55.             'method' => 'delete',
  56.             'path' => '/delete-user',
  57.             'controller' => DeleteUserController::class,
  58.             'write' => false,
  59.         ],
  60.         'removeDeleteRequest' => [
  61.             'normalization_context' => [
  62.                 'groups' => 'read:user:item:me',
  63.             ],
  64.             'method' => 'put',
  65.             'path' => '/remove-delete-request',
  66.             'controller' => RemoveDeleteRequestController::class,
  67.             'write' => false,
  68.         ],
  69.     ],
  70.     itemOperations: [
  71.         'delete',
  72.         'put',
  73.         'get' => [
  74.             'normalization_context' => [
  75.                 'groups' => 'read:user:item:get',
  76.             ],
  77.             'method' => 'GET',
  78.             'path' => '/users/{id}',
  79.             'controller' => GetItemController::class,
  80.         ],
  81.         'me' => [
  82.             'normalization_context' => [
  83.                 'groups' => 'read:user:item:me',
  84.             ],
  85.             'method' => 'GET',
  86.             'path' => '/me',
  87.             'controller' => MeController::class,
  88.             'read' => false,
  89.         ],
  90.         'refreshToken' => [
  91.             'normalization_context' => [
  92.                 'groups' => 'read:user:item:me',
  93.             ],
  94.             'method' => 'POST',
  95.             'path' => '/refresh-token',
  96.             'controller' => RefreshTokenController::class,
  97.             'read' => false,
  98.         ],
  99.         "getUserCompaniesManagement" => [
  100.             'method' => 'GET',
  101.             'path' => '/user-companies-management',
  102.             'controller' => UserCompaniesManagementController::class,
  103.             'normalization_context' => [
  104.                 'groups' => 'read:user:item:user:companies:management',
  105.             ],
  106.             'read' => false,
  107.         ],
  108.     ]
  109. )]
  110. class User implements UserInterfacePasswordAuthenticatedUserInterfaceJWTUserInterface
  111. {
  112.     const GENDER_MALE 'man';
  113.     const GENDER_FEMALE 'woman';
  114.     const GENDER_OTHER 'other';
  115.     #[ORM\Id]
  116.     #[ORM\GeneratedValue]
  117.     #[ORM\Column(type'integer')]
  118.     #[Groups([
  119.         'read:user:collection:get',
  120.         'read:user:item:get',
  121.         'read:user:item:me',
  122.         'read:club:collection:getUsers',
  123.         'read:club:collection:getAds',
  124.         'read:club:collection:getPosts',
  125.         'read:club:collection:getCompanies',
  126.         'read:company:collection:getCollaborators',
  127.         'read:company:collection:get',
  128.     ])]
  129.     private ?int $id;
  130.     use TimestampableEntity;
  131.     #[ORM\Column(type'string'length180uniquetrue)]
  132.     #[Groups([
  133.         'read:user:collection:get',
  134.         'read:user:collection:register',
  135.         'read:user:item:me',
  136.         'read:user:item:get',
  137.         'write:user:collection:register',
  138.         'read:club:collection:getUsers',
  139.     ])]
  140.     #[Assert\Email(
  141.         message'The email {{ value }} is not a valid email.',
  142.     )]
  143.     private string $email;
  144.     #[ORM\Column(typeTypes::JSON)]
  145.     #[Groups([
  146.         'read:user:item:me',
  147.         'read:user:item:get',
  148.         'read:club:collection:getUsers',
  149.     ])]
  150.     private array $roles = [];
  151.     #[ORM\Column(type'string'nullabletrue)]
  152.     #[Groups([
  153.         'write:user:collection:register',
  154.     ])]
  155.     private string $password;
  156.     #[ORM\OneToMany(mappedBy'user'targetEntityPhoto::class, cascade: ["persist""remove"])]
  157.     #[ApiSubresource]
  158.     #[Groups([
  159.         'read:user:item:get',
  160.         'read:user:item:book',
  161.     ])]
  162.     private Collection $photos;
  163.     #[ORM\Column(length255nullabletrue)]
  164.     #[Groups([
  165.         'write:user:collection:put',
  166.         'read:user:item:me',
  167.         'read:user:item:get',
  168.         'read:club:collection:getUsers',
  169.         'read:club:collection:getCompanies',
  170.         'read:company:collection:getCollaborators',
  171.     ])]
  172.     private ?string $firstname null;
  173.     #[ORM\Column(length255nullabletrue)]
  174.     #[Groups([
  175.         'write:user:collection:put',
  176.         'read:user:item:me',
  177.         'read:user:item:get',
  178.         'read:club:collection:getUsers',
  179.         'read:club:collection:getCompanies',
  180.         'read:company:collection:getCollaborators',
  181.     ])]
  182.     private ?string $lastname null;
  183.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  184.     #[Groups([
  185.         'write:user:collection:put',
  186.         'read:user:item:me',
  187.         'read:user:item:get',
  188.         'read:club:collection:getUsers',
  189.     ])]
  190.     private ?string $description null;
  191.     #[ORM\Column(length255nullabletrue)]
  192.     #[Groups([
  193.         'write:user:collection:put',
  194.         'read:user:item:me',
  195.         'read:user:item:get',
  196.         'read:club:collection:getUsers',
  197.     ])]
  198.     private ?string $city null;
  199.     #[ORM\Column(length255nullabletrue)]
  200.     #[Groups([
  201.         'write:user:collection:put',
  202.         'read:user:item:me',
  203.         'read:user:item:get',
  204.     ])]
  205.     private ?string $country null;
  206.     #[ORM\Column(length255nullabletrue)]
  207.     #[Groups([
  208.         'write:user:collection:put',
  209.         'read:user:item:me',
  210.         'read:user:item:get',
  211.     ])]
  212.     private ?string $postalCode null;
  213.     #[ORM\Column(typeTypes::DATETIME_MUTABLEnullabletrue)]
  214.     #[Groups([
  215.         'write:user:collection:put',
  216.         'read:user:item:me',
  217.         'read:user:item:get',
  218.     ])]
  219.     private ?DateTimeInterface $birthDate null;
  220.     #[ORM\Column(length255nullabletrue)]
  221.     #[Groups([
  222.         'read:user:item:me',
  223.         'read:club:collection:getUsers',
  224.         'read:user:item:get',
  225.     ])]
  226.     private ?string $phone null;
  227.     #[ORM\Column(length50nullabletrue)]
  228.     #[Groups([
  229.         'write:user:collection:put',
  230.         'read:user:item:me',
  231.         'read:user:item:get',
  232.         'read:club:collection:getUsers',
  233.     ])]
  234.     private ?string $gender null;
  235.     #[ORM\Column(nullabletrue)]
  236.     private ?bool $adminPublicProfile null;
  237.     #[Groups([
  238.         'read:user:item:me',
  239.     ])]
  240.     #[ORM\Column(length255nullabletrue)]
  241.     private ?string $stripeId null;
  242.     #[ORM\OneToMany(mappedBy'author'targetEntityPost::class)]
  243.     private Collection $posts;
  244.     #[ORM\OneToMany(mappedBy'user'targetEntityCollaborator::class, cascade: ["persist"])]
  245.     #[Groups([
  246.         'read:user:item:get',
  247.         'read:user:collection:get',
  248.         'read:club:collection:getUsers',
  249.         'read:user:item:me',
  250.     ])]
  251.     private Collection $collaborators;
  252.     private ?array $clubs;
  253.     #[ORM\OneToMany(mappedBy'author'targetEntityAd::class)]
  254.     private Collection $ads;
  255.     #[ORM\Column(typeTypes::TEXTnullabletrue)]
  256.     private ?string $fti null;
  257.     #[Groups([
  258.         'read:user:item:get',
  259.         'read:user:collection:get',
  260.         'read:club:collection:getUsers',
  261.         'read:user:item:me',
  262.     ])]
  263.     #[ORM\Column(length255nullabletrue)]
  264.     private ?string $title null;
  265.     #[ORM\OneToMany(mappedBy'user'targetEntityUserClub::class)]
  266.     private Collection $userClubs;
  267.     #[ORM\OneToMany(mappedBy'creator'targetEntityCompany::class)]
  268.     #[Groups('read:user:item:user:companies:management')]
  269.     private Collection $companies;
  270.     #[ORM\OneToMany(mappedBy'claimer'targetEntityClaimingRequest::class)]
  271.     private Collection $claimingRequests;
  272.     #[ORM\OneToMany(mappedBy'user'targetEntityClubManager::class, cascade: ["persist"])]
  273.     private Collection $clubManagers;
  274.     #[ORM\Column(length255nullabletrue)]
  275.     #[Groups([
  276.         'write:user:collection:put',
  277.         'read:user:item:me',
  278.     ])]
  279.     private ?string $notificationToken null;
  280.     #[ORM\Column]
  281.     #[Groups([
  282.         'read:user:item:me',
  283.         'write:user:collection:put',
  284.     ])]
  285.     private ?bool $acceptNotification null;
  286.     #[ORM\Column(nullabletrue)]
  287.     private ?string $googleId null;
  288.     #[ORM\Column(length255nullabletrue)]
  289.     private ?string $googleName null;
  290.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  291.     #[Groups('read:user:item:me')]
  292.     private ?DateTimeInterface $deleteRequestDate null;
  293.     public function __construct()
  294.     {
  295.         $this->id null;
  296.         $this->photos = new ArrayCollection();
  297.         $this->adminPublicProfile false;
  298.         $this->posts = new ArrayCollection();
  299.         $this->collaborators = new ArrayCollection();
  300.         $this->ads = new ArrayCollection();
  301.         $this->userClubs = new ArrayCollection();
  302.         $this->companies = new ArrayCollection();
  303.         $this->claimingRequests = new ArrayCollection();
  304.         $this->clubManagers = new ArrayCollection();
  305.         $this->acceptNotification true;
  306.     }
  307.     public static function createFromPayload($username, array $payload): User
  308.     {
  309.         $user = new User();
  310.         $user->setEmail($username);
  311.         return $user;
  312.     }
  313.     /** @see UserInterface */
  314.     public function getUserIdentifier(): string
  315.     {
  316.         return $this->email;
  317.     }
  318.     public function getUsername(): ?string
  319.     {
  320.         return $this->email;
  321.     }
  322.     /** @see UserInterface */
  323.     public function getRoles(): array
  324.     {
  325.         $roles $this->roles;
  326.         // guarantee every user at least has ROLE_USER
  327.         $roles[] = 'ROLE_USER';
  328.         if ($this->clubManagers->count() > 0) {
  329.             $roles[] = 'ROLE_CLUB_MANAGER';
  330.         }
  331.         return array_unique($roles);
  332.     }
  333.     public function setRoles(array $roles): self
  334.     {
  335.         $this->roles $roles;
  336.         return $this;
  337.     }
  338.     /** @see UserInterface */
  339.     public function eraseCredentials()
  340.     {
  341.         // If you store any temporary, sensitive data on the user, clear it here
  342.         // $this->plainPassword = null;
  343.     }
  344.     /**
  345.      * @see PasswordAuthenticatedUserInterface
  346.      */
  347.     public function getPassword(): string
  348.     {
  349.         return $this->password;
  350.     }
  351.     public function setPassword(string $password): self
  352.     {
  353.         $this->password $password;
  354.         return $this;
  355.     }
  356.     #[Groups([
  357.         'read:user:collection:get',
  358.         'write:user:collection:register',
  359.         'read:user:item:get',
  360.         'read:user:item:me',
  361.         'read:club:collection:getUsers',
  362.         'read:club:collection:getCompanies',
  363.     ])]
  364.     public function getAvatarUrl(): string
  365.     {
  366.         $mainPhoto $this->getMainPhoto();
  367.         if ($mainPhoto) {
  368.             return $mainPhoto->getImageLarge()->getUrl();
  369.         }
  370.         return 'https://localbeez.ri7.fr/assets/img/image_placeholder.jpg';
  371.     }
  372.     public function getMainPhoto()
  373.     {
  374.         foreach ($this->photos as $p) {
  375.             if ($p->isMain()) {
  376.                 return $p;
  377.             }
  378.         }
  379.         if (sizeof($this->photos) > 0) {
  380.             return $this->photos[0];
  381.         }
  382.         return false;
  383.     }
  384.     #[Groups([
  385.         'read:user:collection:get',
  386.         'write:user:collection:register',
  387.         'read:user:item:get',
  388.         'read:club:collection:getPosts',
  389.         'read:club:collection:getAds',
  390.         'read:user:item:me',
  391.         'read:club:collection:getUsers',
  392.         'read:club:collection:getPosts',
  393.         'read:club:collection:getAds',
  394.         'read:company:collection:getCollaborators',
  395.     ])]
  396.     public function getSmallAvatarUrl(): string
  397.     {
  398.         $mainPhoto $this->getMainPhoto();
  399.         if ($mainPhoto) {
  400.             return $mainPhoto->getImageSmall()->getUrl();
  401.         }
  402.         return 'https://localbeez.ri7.fr/assets/img/image_placeholder.jpg';
  403.     }
  404.     #[Groups([
  405.         'read:user:collection:get',
  406.         'write:user:collection:register',
  407.         'read:user:item:get',
  408.         'read:user:item:me',
  409.         'read:club:collection:getUsers',
  410.     ])]
  411.     public function getMediumAvatarUrl(): string
  412.     {
  413.         $mainPhoto $this->getMainPhoto();
  414.         if ($mainPhoto) {
  415.             return $mainPhoto->getImageMedium()->getUrl();
  416.         }
  417.         return 'https://localbeez.ri7.fr/assets/img/image_placeholder.jpg';
  418.     }
  419.     public function __toString()
  420.     {
  421.         return $this->getShortname();
  422.     }
  423.     #[Groups([
  424.         'read:club:collection:getPosts',
  425.         'read:club:collection:getAds',
  426.         'read:user:item:get',
  427.     ])]
  428.     public function getShortname()
  429.     {
  430.         if (($this->firstname != null) && ($this->lastname != null)) {
  431.             return $this->firstname.'.'.mb_substr($this->lastname01);
  432.         } elseif ($this->firstname != null) {
  433.             return $this->firstname;
  434.         }
  435.         return $this->email;
  436.     }
  437.     public function getFullName()
  438.     {
  439.         if (($this->firstname == null) && ($this->lastname == null) && ($this->googleName != null)) {
  440.             return $this->googleName;
  441.         }
  442.         return $this->firstname.' '.$this->lastname;
  443.     }
  444.     public function getGenderLabel(): ?string
  445.     {
  446.         $genders self::getGenderList();
  447.         return ($this->getGender() != null) ? $genders[$this->getGender()] : null;
  448.     }
  449.     public static function getGenderList()
  450.     {
  451.         return array(
  452.             self::GENDER_FEMALE => 'Femme',
  453.             self::GENDER_MALE => 'Homme',
  454.             self::GENDER_OTHER => 'Autre',
  455.         );
  456.     }
  457.     #[Groups([
  458.         'read:user:item:me',
  459.     ])]
  460.     public function getClubs(): ?array
  461.     {
  462.         return $this->clubs;
  463.     }
  464.     public function setClubs($clubs): self
  465.     {
  466.         $this->clubs $clubs;
  467.         return $this;
  468.     }
  469.     public function getId(): ?int
  470.     {
  471.         return $this->id;
  472.     }
  473.     public function getEmail(): ?string
  474.     {
  475.         return $this->email;
  476.     }
  477.     public function setEmail(string $email): self
  478.     {
  479.         $this->email $email;
  480.         return $this;
  481.     }
  482.     public function getFirstname(): ?string
  483.     {
  484.         return $this->firstname;
  485.     }
  486.     public function setFirstname(?string $firstname): self
  487.     {
  488.         $this->firstname $firstname;
  489.         return $this;
  490.     }
  491.     public function getLastname(): ?string
  492.     {
  493.         return $this->lastname;
  494.     }
  495.     public function setLastname(?string $lastname): self
  496.     {
  497.         $this->lastname $lastname;
  498.         return $this;
  499.     }
  500.     public function getDescription(): ?string
  501.     {
  502.         return $this->description;
  503.     }
  504.     public function setDescription(?string $description): self
  505.     {
  506.         $this->description $description;
  507.         return $this;
  508.     }
  509.     public function getCity(): ?string
  510.     {
  511.         return $this->city;
  512.     }
  513.     public function setCity(?string $city): self
  514.     {
  515.         $this->city $city;
  516.         return $this;
  517.     }
  518.     public function getCountry(): ?string
  519.     {
  520.         return $this->country;
  521.     }
  522.     public function setCountry(?string $country): self
  523.     {
  524.         $this->country $country;
  525.         return $this;
  526.     }
  527.     public function getPostalCode(): ?string
  528.     {
  529.         return $this->postalCode;
  530.     }
  531.     public function setPostalCode(?string $postalCode): self
  532.     {
  533.         $this->postalCode $postalCode;
  534.         return $this;
  535.     }
  536.     public function getBirthDate(): ?DateTimeInterface
  537.     {
  538.         return $this->birthDate;
  539.     }
  540.     public function setBirthDate(?DateTimeInterface $birthDate): self
  541.     {
  542.         $this->birthDate $birthDate;
  543.         return $this;
  544.     }
  545.     public function getPhone(): ?string
  546.     {
  547.         return $this->phone;
  548.     }
  549.     public function setPhone(?string $phone): self
  550.     {
  551.         $this->phone $phone;
  552.         return $this;
  553.     }
  554.     public function getGender(): ?string
  555.     {
  556.         return $this->gender;
  557.     }
  558.     public function setGender(?string $gender): self
  559.     {
  560.         $this->gender $gender;
  561.         return $this;
  562.     }
  563.     public function isAdminPublicProfile(): ?bool
  564.     {
  565.         return $this->adminPublicProfile;
  566.     }
  567.     public function setAdminPublicProfile(?bool $adminPublicProfile): self
  568.     {
  569.         $this->adminPublicProfile $adminPublicProfile;
  570.         return $this;
  571.     }
  572.     public function getStripeId(): ?string
  573.     {
  574.         return $this->stripeId;
  575.     }
  576.     public function setStripeId(?string $stripeId): self
  577.     {
  578.         $this->stripeId $stripeId;
  579.         return $this;
  580.     }
  581.     /**
  582.      * @return Collection<int, Photo>
  583.      */
  584.     public function getPhotos(): Collection
  585.     {
  586.         return $this->photos;
  587.     }
  588.     public function addPhoto(Photo $photo): self
  589.     {
  590.         if (!$this->photos->contains($photo)) {
  591.             $this->photos->add($photo);
  592.             $photo->setUser($this);
  593.         }
  594.         return $this;
  595.     }
  596.     public function removePhoto(Photo $photo): self
  597.     {
  598.         if ($this->photos->removeElement($photo)) {
  599.             // set the owning side to null (unless already changed)
  600.             if ($photo->getUser() === $this) {
  601.                 $photo->setUser(null);
  602.             }
  603.         }
  604.         return $this;
  605.     }
  606.     /**
  607.      * @return Collection<int, Post>
  608.      */
  609.     public function getPosts(): Collection
  610.     {
  611.         return $this->posts;
  612.     }
  613.     public function addPost(Post $post): self
  614.     {
  615.         if (!$this->posts->contains($post)) {
  616.             $this->posts->add($post);
  617.             $post->setAuthor($this);
  618.         }
  619.         return $this;
  620.     }
  621.     public function removePost(Post $post): self
  622.     {
  623.         if ($this->posts->removeElement($post)) {
  624.             // set the owning side to null (unless already changed)
  625.             if ($post->getAuthor() === $this) {
  626.                 $post->setAuthor(null);
  627.             }
  628.         }
  629.         return $this;
  630.     }
  631.     /**
  632.      * @return Collection<int, Collaborator>
  633.      */
  634.     public function getCollaborators(): Collection
  635.     {
  636.         return $this->collaborators;
  637.     }
  638.     public function addCollaborator(Collaborator $collaborator): self
  639.     {
  640.         if (!$this->collaborators->contains($collaborator)) {
  641.             $this->collaborators->add($collaborator);
  642.             $collaborator->setUser($this);
  643.         }
  644.         return $this;
  645.     }
  646.     public function removeCollaborator(Collaborator $collaborator): self
  647.     {
  648.         if ($this->collaborators->removeElement($collaborator)) {
  649.             // set the owning side to null (unless already changed)
  650.             if ($collaborator->getUser() === $this) {
  651.                 $collaborator->setUser(null);
  652.             }
  653.         }
  654.         return $this;
  655.     }
  656.     /**
  657.      * @return Collection<int, Ad>
  658.      */
  659.     public function getAds(): Collection
  660.     {
  661.         return $this->ads;
  662.     }
  663.     public function addAd(Ad $ad): self
  664.     {
  665.         if (!$this->ads->contains($ad)) {
  666.             $this->ads->add($ad);
  667.             $ad->setAuthor($this);
  668.         }
  669.         return $this;
  670.     }
  671.     public function removeAd(Ad $ad): self
  672.     {
  673.         if ($this->ads->removeElement($ad)) {
  674.             // set the owning side to null (unless already changed)
  675.             if ($ad->getAuthor() === $this) {
  676.                 $ad->setAuthor(null);
  677.             }
  678.         }
  679.         return $this;
  680.     }
  681.     public function getFti(): ?string
  682.     {
  683.         return $this->fti;
  684.     }
  685.     public function setFti(?string $fti): self
  686.     {
  687.         $this->fti $fti;
  688.         return $this;
  689.     }
  690.     public function getTitle(): ?string
  691.     {
  692.         return $this->title;
  693.     }
  694.     public function setTitle(?string $title): self
  695.     {
  696.         $this->title $title;
  697.         return $this;
  698.     }
  699.     /**
  700.      * @return Collection<int, UserClub>
  701.      */
  702.     public function getUserClubs(): Collection
  703.     {
  704.         return $this->userClubs;
  705.     }
  706.     public function addUserClub(UserClub $userClub): self
  707.     {
  708.         if (!$this->userClubs->contains($userClub)) {
  709.             $this->userClubs->add($userClub);
  710.             $userClub->setUser($this);
  711.         }
  712.         return $this;
  713.     }
  714.     public function removeUserClub(UserClub $userClub): self
  715.     {
  716.         if ($this->userClubs->removeElement($userClub)) {
  717.             // set the owning side to null (unless already changed)
  718.             if ($userClub->getUser() === $this) {
  719.                 $userClub->setUser(null);
  720.             }
  721.         }
  722.         return $this;
  723.     }
  724.     /**
  725.      * @return Collection<int, Company>
  726.      */
  727.     public function getCompanies(): Collection
  728.     {
  729.         return $this->companies;
  730.     }
  731.     public function addCompany(Company $company): self
  732.     {
  733.         if (!$this->companies->contains($company)) {
  734.             $this->companies->add($company);
  735.             $company->setCreator($this);
  736.         }
  737.         return $this;
  738.     }
  739.     public function removeCompany(Company $company): self
  740.     {
  741.         if ($this->companies->removeElement($company)) {
  742.             // set the owning side to null (unless already changed)
  743.             if ($company->getCreator() === $this) {
  744.                 $company->setCreator(null);
  745.             }
  746.         }
  747.         return $this;
  748.     }
  749.     /**
  750.      * @return Collection<int, ClaimingRequest>
  751.      */
  752.     public function getClaimingRequests(): Collection
  753.     {
  754.         return $this->claimingRequests;
  755.     }
  756.     public function addClaimingRequest(ClaimingRequest $claimingRequest): self
  757.     {
  758.         if (!$this->claimingRequests->contains($claimingRequest)) {
  759.             $this->claimingRequests->add($claimingRequest);
  760.             $claimingRequest->setClaimer($this);
  761.         }
  762.         return $this;
  763.     }
  764.     public function removeClaimingRequest(ClaimingRequest $claimingRequest): self
  765.     {
  766.         if ($this->claimingRequests->removeElement($claimingRequest)) {
  767.             // set the owning side to null (unless already changed)
  768.             if ($claimingRequest->getClaimer() === $this) {
  769.                 $claimingRequest->setClaimer(null);
  770.             }
  771.         }
  772.         return $this;
  773.     }
  774.     /**
  775.      * @return Collection<int, ClubManager>
  776.      */
  777.     public function getClubManagers(): Collection
  778.     {
  779.         return $this->clubManagers;
  780.     }
  781.     public function addClubManager(ClubManager $clubManager): static
  782.     {
  783.         if (!$this->clubManagers->contains($clubManager)) {
  784.             $this->clubManagers->add($clubManager);
  785.             $clubManager->setUser($this);
  786.         }
  787.         return $this;
  788.     }
  789.     public function removeClubManager(ClubManager $clubManager): static
  790.     {
  791.         if ($this->clubManagers->removeElement($clubManager)) {
  792.             // set the owning side to null (unless already changed)
  793.             if ($clubManager->getUser() === $this) {
  794.                 $clubManager->setUser(null);
  795.             }
  796.         }
  797.         return $this;
  798.     }
  799.     public function getNotificationToken(): ?string
  800.     {
  801.         return $this->notificationToken;
  802.     }
  803.     public function setNotificationToken(?string $notificationToken): static
  804.     {
  805.         $this->notificationToken $notificationToken;
  806.         return $this;
  807.     }
  808.     public function isAcceptNotification(): ?bool
  809.     {
  810.         return $this->acceptNotification;
  811.     }
  812.     public function setAcceptNotification(bool $acceptNotification): static
  813.     {
  814.         $this->acceptNotification $acceptNotification;
  815.         return $this;
  816.     }
  817.     public function getGoogleId(): ?string
  818.     {
  819.         return $this->googleId;
  820.     }
  821.     public function setGoogleId(?string $googleId): static
  822.     {
  823.         $this->googleId $googleId;
  824.         return $this;
  825.     }
  826.     public function getGoogleName(): ?string
  827.     {
  828.         return $this->googleName;
  829.     }
  830.     public function setGoogleName(?string $googleName): static
  831.     {
  832.         $this->googleName $googleName;
  833.         return $this;
  834.     }
  835.     public function getDeleteRequestDate(): ?DateTimeInterface
  836.     {
  837.         return $this->deleteRequestDate;
  838.     }
  839.     public function setDeleteRequestDate(?DateTimeInterface $deleteRequestDate): static
  840.     {
  841.         $this->deleteRequestDate $deleteRequestDate;
  842.         return $this;
  843.     }
  844. }