src/Entity/User.php line 19
<?phpnamespace App\Entity;use App\Repository\UserRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;use Symfony\Component\Security\Core\User\UserInterface;#[ORM\Entity(repositoryClass: UserRepository::class)]#[ORM\Table(name: '`user`')]#[UniqueEntity(fields: ['email'], message: 'There is already an account with this email')]# [UniqueEntity(fields: ['username'], message: 'There is already an account with this username')]class User implements UserInterface, PasswordAuthenticatedUserInterface{public const ROLE_USER = "ROLE_USER";public const ROLE_MEMBER = "ROLE_MEMBER";public const ROLE_ADMIN = "ROLE_ADMIN";public const ROLE_SUPER_ADMIN = "ROLE_SUPER_ADMIN";const STATUS_DRAFT = 1;const STATUS_VALID = 2;const STATUS_FAILED = 3;const STATUS_WAITING = 4;const STATUS_REFUSED = 5; // ce status est ajouté pour le caas de refus d'administrateurconst STATUS_PAYMENT_PENDING = "Pending";const STATUS_PAYMENT_SUCCESS = "Success";const STATUS_PAYMENT_FAILED = "Failed";const NO_MEMBERSHIP_REQUEST=0;const MEMBERSHIP_REQUEST_PENDING=1;const MEMBERSHIP_REQUEST_ACCEPTED=2;const SEXE_HOMME = 1;const SEXE_FEMME = 2;// const CV_MARRIED = 1;// const CV_SINGLE = 2;const CV_MR = 1;const CV_MME = 2;const CV_MLLE = 3;#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 180, unique: true)]private ?string $username = null;#[ORM\Column(nullable: true)]private array $roles = [];/*** @var string The hashed password*/#[ORM\Column]private ?string $password = null;#[ORM\Column(length: 255)]private ?string $firstname = null;#[ORM\Column(length: 255)]private ?string $lastname = null;#[ORM\Column(length: 255)]private ?string $email = null;#[ORM\Column]private ?bool $status = null;#[ORM\Column(length: 255)]private ?string $title = null;#[ORM\Column(type: Types::SMALLINT, nullable: true)]private ?int $civility = null;#[ORM\Column(type: Types::SMALLINT)]private ?int $sexe = null;#[ORM\Column(length: 200)]private ?string $country = null;#[ORM\Column(length: 400)]private ?string $adresse = null;#[ORM\Column(length: 255)]private ?string $city = null;#[ORM\Column(nullable: true)]private ?int $postalCode = null;#[ORM\Column(length: 255)]private ?string $workplace = null;#[ORM\Column(length: 20)]private ?string $mobile = null;#[ORM\Column(length: 20, nullable: true)]private ?string $phone = null;#[ORM\Column(length: 255)]private ?string $speciality = null;#[ORM\Column(length: 255)]private ?string $activity = null;#[ORM\OneToMany(mappedBy: 'user', targetEntity: ResetPassword::class)]private Collection $resetPasswords;#[ORM\OneToMany(mappedBy: 'user', targetEntity: Inscription::class)]private Collection $inscriptions;#[ORM\OneToOne(mappedBy: 'user', targetEntity: Participant::class)]private ?Participant $participant;#[ORM\Column(type: 'datetime')]private $createdAt;#[ORM\Column(type: 'datetime', nullable: true)]private $updatedAt;#[ORM\Column(type: 'boolean')]private $isVerified = false;#[ORM\Column(nullable: true)]private ?int $countryIdentifier = null;#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]private ?\DateTimeInterface $expirationDate = null;#[ORM\Column(length: 255, nullable: true)]private ?string $token = null;/** @var EventAbstract[]|ArrayCollection */#[ORM\OneToMany(targetEntity: EventAbstract::class, mappedBy: 'user')]private Collection $eventAbstracts;#[ORM\Column(type: Types::BOOLEAN)]private ?bool $isMember = false;#[ORM\Column(type: Types::BOOLEAN)]private ?bool $isMemberShip = false;#[ORM\Column(type: Types::JSON, options:[])] // 'default' => "[]"private ?array $memberYears = [];#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]private ?\DateTime $lastLoginAt;#[ORM\Column(type: Types::INTEGER, nullable: true, options: ['default' => 0])]private ?int $demandeMembership = null;#[ORM\Column(type: Types::DATETIME_MUTABLE, nullable: true)]private ?\DateTime $demandeMembershipAt = null;public function __construct(){$this->resetPasswords = new ArrayCollection();$this->inscriptions = new ArrayCollection();$this->eventAbstracts = new ArrayCollection();$this->participant = null;$this->isMember = false;$this->isMemberShip = false;$this->memberYears = [];$this->demandeMembership=self::NO_MEMBERSHIP_REQUEST;$this->lastLoginAt = null;}public function getId(): ?int{return $this->id;}public function getUsername(): ?string{return $this->username;}public function setUsername(string $username): self{$this->username = $username;return $this;}/*** A visual identifier that represents this user.** @see UserInterface*/public function getUserIdentifier(): string{return (string) $this->username;}/*** @see UserInterface*/public function getRoles(): array{$roles = $this->roles;// guarantee every user at least has ROLE_USER$roles[] = 'ROLE_USER';return array_unique($roles);}public function setRoles(array $roles): self{$this->roles = $roles;return $this;}public function hasRole(string $role): bool{if ($role && $this->getRoles()) {return in_array($role, $this->getRoles());}return false;}/*** @see PasswordAuthenticatedUserInterface*/public function getPassword(): string{return $this->password;}public function setPassword(string $password): self{$this->password = $password;return $this;}/*** @see UserInterface*/public function eraseCredentials(){// If you store any temporary, sensitive data on the user, clear it here// $this->plainPassword = null;}public function getFirstname(): ?string{return $this->firstname;}public function setFirstname(string $firstname): self{$this->firstname = $firstname;return $this;}public function getLastname(): ?string{return $this->lastname;}public function setLastname(string $lastname): self{$this->lastname = $lastname;return $this;}public function getEmail(): ?string{return $this->email;}public function setEmail(string $email): self{$this->email = $email;return $this;}public function getTitle(): ?string{return $this->title;}public function setTitle(string $title): self{$this->title = $title;return $this;}public function isTitleResidant(): bool{return $this->title && $this->title == AppConstants::TITLE_RESIDENT;}public function getSexe(): ?int{return $this->sexe;}public function setSexe(int $sexe): self{$this->sexe = $sexe;return $this;}public function getCountry(): ?string{return $this->country;}public function setCountry(string $country): self{$this->country = $country;return $this;}public function getAdresse(): ?string{return $this->adresse;}public function setAdresse(string $adresse): self{$this->adresse = $adresse;return $this;}public function getCity(): ?string{return $this->city;}public function setCity(string $city): self{$this->city = $city;return $this;}public function getPostalCode(): ?int{return $this->postalCode;}public function setPostalCode(int $postalCode): self{$this->postalCode = $postalCode;return $this;}public function getWorkplace(): ?string{return $this->workplace;}public function setWorkplace(string $workplace): self{$this->workplace = $workplace;return $this;}public function getMobile(): ?string{return $this->mobile;}public function setMobile(string $mobile): self{$this->mobile = $mobile;return $this;}public function getPhone(): ?string{return $this->phone;}public function setPhone(string $phone): self{$this->phone = $phone;return $this;}public function getSpeciality(): ?string{return $this->speciality;}public function setSpeciality(string $speciality): self{$this->speciality = $speciality;return $this;}public function getActivity(): ?string{return $this->activity;}public function setActivity(string $activity): self{$this->activity = $activity;return $this;}public function getCivility(): ?int{if (is_null($this->civility)) {if ($this->sexe == self::SEXE_HOMME) {$this->civility = self::CV_MR;} elseif ($this->sexe == self::SEXE_FEMME) {$this->civility = self::CV_MME;}}return $this->civility;}public function setCivility(int $civility): self{$this->civility = $civility;return $this;}public function isStatus(): ?bool{return $this->status;}public function getStatus(): ?string{return ($this->status);}public function setStatus(bool $status): self{$this->status = $status;return $this;}/*** @return Collection<int, ResetPassword>*/public function getResetPasswords(): Collection{return $this->resetPasswords;}public function addResetPassword(ResetPassword $resetPassword): self{if (!$this->resetPasswords->contains($resetPassword)) {$this->resetPasswords->add($resetPassword);$resetPassword->setUser($this);}return $this;}public function removeResetPassword(ResetPassword $resetPassword): self{if ($this->resetPasswords->removeElement($resetPassword)) {// set the owning side to null (unless already changed)if ($resetPassword->getUser() === $this) {$resetPassword->setUser(null);}}return $this;}public function getCreatedAt(): ?\DateTimeInterface{return $this->createdAt;}public function setCreatedAt(\DateTimeInterface $createdAt): self{$this->createdAt = $createdAt;return $this;}public function getUpdatedAt(): ?\DateTimeInterface{return $this->updatedAt;}public function setUpdatedAt(?\DateTimeInterface $updatedAt): self{$this->updatedAt = $updatedAt;return $this;}/*** Get the value of inscriptions*/public function getInscriptions(): Collection{return $this->inscriptions;}/*** Set the value of inscriptions*/public function setInscriptions(Collection $inscriptions): self{$this->inscriptions = $inscriptions;return $this;}public function isVerified(): bool{return $this->isVerified;}public function setIsVerified(bool $isVerified): static{$this->isVerified = $isVerified;return $this;}public function getExpirationDate(): ?\DateTimeInterface{return $this->expirationDate;}public function setExpirationDate(?\DateTimeInterface $expirationDate): static{$this->expirationDate = $expirationDate;return $this;}public function getToken(): ?string{return $this->token;}public function setToken(?string $token): static{$this->token = $token;return $this;}/*** @return Collection<int, EventAbstract>*/public function getEventAbstracts(): Collection{return $this->eventAbstracts;}public function addEventAbstract(EventAbstract $eventAbstract): static{if (!$this->eventAbstracts->contains($eventAbstract)) {$this->eventAbstracts->add($eventAbstract);$eventAbstract->setUser($this);}return $this;}public function removeEventAbstract(EventAbstract $eventAbstract): static{if ($this->eventAbstracts->removeElement($eventAbstract)) {// set the owning side to null (unless already changed)if ($eventAbstract->getUser() === $this) {$eventAbstract->setUser(null);}}return $this;}public function getCountryIdentifier(): ?int{return $this->countryIdentifier;}public function setCountryIdentifier(?int $countryIdentifier): static{$this->countryIdentifier = $countryIdentifier;return $this;}/*** Get the value of isMember*/public function isMember(){return $this->isMember;}/*** Get the value of isMember*/public function getIsMember(){return $this->isMember();}/*** Set the value of isMember** @return self*/public function setIsMember($isMember){$this->isMember = $isMember;return $this;}/*** Set the value of isMember** @return self*/public function isMemberShip($year = null){if (is_null($year)) {$year = date('Y');if ($this->memberYears) {foreach ($this->memberYears as $memberYear) {if (isset($memberYear['year']) && $memberYear['year'] == $year) {return true;}}}}// return $this->isMemberShip;return false;}/*** Get the value of isMemberShip*/public function getIsMemberShip(){return $this->isMemberShip();}/*** Set the value of isMemberShip** @return self*/public function setIsMemberShip($isMemberShip){$this->isMemberShip = $isMemberShip;return $this;}/*** Get the value of memberYears*/public function getMemberYears(){if (is_null($this->memberYears)) {$this->memberYears = [];}return $this->memberYears;}/*** Set the value of memberYears** @return self*/public function setMemberYears($memberYears = []){if (is_null($memberYears)) {$memberYears = [];}$this->memberYears = $memberYears;return $this;}/*** Get the value of lastLoginAt** @return \DateTime*/public function getLastLoginAt(): ?\DateTime{return $this->lastLoginAt;}/*** Set the value of lastLoginAt** @param \DateTime $lastLoginAt** @return self*/public function setLastLoginAt(?\DateTime $lastLoginAt){$this->lastLoginAt = $lastLoginAt;return $this;}public function getDemandeMembership(): ?int{return $this->demandeMembership;}public function setDemandeMembership(?int $demandeMembership): static{$this->demandeMembership = $demandeMembership;return $this;}/*** Get the value of demandeMembershipAt*/public function getDemandeMembershipAt(): ?\DateTime{return $this->demandeMembershipAt;}/*** Set the value of demandeMembershipAt** @return self*/public function setDemandeMembershipAt(?\DateTime $demandeMembershipAt){$this->demandeMembershipAt = $demandeMembershipAt;return $this;}}