src/Entity/User.php line 14
<?phpnamespace App\Entity;use App\Repository\UserRepository;use Doctrine\Common\Collections\Collection;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)]#[UniqueEntity(fields: ['email'], message: 'There is already an account with this email')]class User implements UserInterface, PasswordAuthenticatedUserInterface{public static function generatePassword($length = 8){$chars = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%&*()-_=+';$password = '';for ($i = 0; $i < $length; $i++) {$password .= $chars[rand(0, strlen($chars) - 1)];}return $password;}#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 180, unique: true)]private ?string $email = null;#[ORM\Column]private array $roles = [];#[ORM\OneToMany(mappedBy: 'user', targetEntity: Cart::class)]private ?Collection $cart;#[ORM\OneToMany(mappedBy: 'user', targetEntity: SpecialCustomer::class)]private ?Collection $specialCustomerPourcent;#[ORM\Column(name: 'specialCustomer', type: 'boolean', nullable: true)]private ?bool $specialCustomer;#[ORM\OneToMany(mappedBy: 'user', targetEntity: CustomerControl::class)]private ?Collection $customer;#[ORM\OneToMany(mappedBy: 'customer', targetEntity: CustomerControl::class)]private ?Collection $customerControl;#[ORM\OneToMany(mappedBy: 'user', targetEntity: Billings::class)]private ?Collection $billings;#[ORM\OneToMany(mappedBy: 'user', targetEntity: Invoices::class)]private ?Collection $invoice;#[ORM\OneToMany(mappedBy: 'user', targetEntity: CartFinished::class)]private ?Collection $cartFinished;#[ORM\OneToMany(mappedBy: 'user', targetEntity: AdditionalCompanyInformation::class)]private ?Collection $AdditionalCompanyInformation;#[ORM\OneToMany(mappedBy: 'user', targetEntity: Joker::class)]private ?Collection $joker;#[ORM\OneToMany(mappedBy: 'user', targetEntity: DeliveryAddress::class)]private ?Collection $deliveryAddress;#[ORM\OneToMany(mappedBy: 'client', targetEntity: Tva::class)]private ?Collection $tva;#[ORM\Column(name: 'generatePasswordRecovery', type: 'string', nullable: true)]private ?string $generatePasswordRecovery;// #[ORM\Column(name: 'typeOfProfessional', type: 'string', nullable: true)]// private ?string $typeOfProfessional;#[ORM\Column(name: 'additionalPercentage', type: 'float', nullable: true)]private ?float $additionalPercentage = 0.0;#[ORM\Column(name: 'name', type: 'string', nullable: true)]private ?string $name;#[ORM\Column(name: 'firstName', type: 'string', nullable: true)]private ?string $firstName;#[ORM\Column(name: 'address', type: 'string', nullable: true)]private ?string $address;#[ORM\Column(name: 'postal', type: 'string', nullable: true)]private ?string $postal;#[ORM\Column(name: 'locality', type: 'string', nullable: true)]private ?string $locality;#[ORM\Column(name: 'country', type: 'string', nullable: true)]private ?string $country;#[ORM\Column(name: 'phoneNumber', type: 'string', nullable: true)]private ?string $phoneNumber;#[ORM\Column(name: 'directPhone', type: 'string', nullable: true)]private ?string $directPhone;#[ORM\Column(name: 'otherMail', type: 'string', nullable: true)]private ?string $otherMail;#[ORM\Column(name: 'companyName', type: 'string', nullable: true)]private ?string $companyName;#[ORM\Column(name: 'active', type: 'boolean', nullable: true)]private ?bool $active;#[ORM\Column(name: 'gender', type: 'string', nullable: true)]private ?string $gender;#[ORM\Column(name: 'userSupplementsPurchaseDecisionMaker', type: 'boolean', nullable: true)]private ?bool $userSupplementsPurchaseDecisionMaker;/*** @return string|null*/public function getGeneratePasswordRecovery(): ?string{return $this->generatePasswordRecovery;}/*** @param string|null $generatePasswordRecovery*/public function setGeneratePasswordRecovery(?string $generatePasswordRecovery): void{$this->generatePasswordRecovery = $generatePasswordRecovery;}/*** @return Collection|null*/public function getSpecialCustomerPourcent(): ?Collection{return $this->specialCustomerPourcent;}/*** @param Collection|null $specialCustomerPourcent*/public function setSpecialCustomerPourcent(?Collection $specialCustomerPourcent): void{$this->specialCustomerPourcent = $specialCustomerPourcent;}/*** @return bool|null*/public function getSpecialCustomer(): ?bool{return $this->specialCustomer;}/*** @param bool|null $specialCustomer*/public function setSpecialCustomer(?bool $specialCustomer): void{$this->specialCustomer = $specialCustomer;}/*** @return Collection|null*/public function getInvoice(): ?Collection{return $this->invoice;}/*** @param Collection|null $invoice*/public function setInvoice(?Collection $invoice): void{$this->invoice = $invoice;}/*** @return Collection|null*/public function getCustomer(): ?Collection{return $this->customer;}/*** @param Collection|null $customer*/public function setCustomer(?Collection $customer): void{$this->customer = $customer;}/*** @return Collection|null*/public function getCustomerControl(): ?Collection{return $this->customerControl;}/*** @param Collection|null $customerControl*/public function setCustomerControl(?Collection $customerControl): void{$this->customerControl = $customerControl;}/*** @return bool|null*/public function getUserSupplementsPurchaseDecisionMaker(): ?bool{return $this->userSupplementsPurchaseDecisionMaker;}/*** @param bool|null $userSupplementsPurchaseDecisionMaker*/public function setUserSupplementsPurchaseDecisionMaker(?bool $userSupplementsPurchaseDecisionMaker): void{$this->userSupplementsPurchaseDecisionMaker = $userSupplementsPurchaseDecisionMaker;}/*** @return string|null*/public function getGender(): ?string{return $this->gender;}/*** @param string|null $gender*/public function setGender(?string $gender): void{$this->gender = $gender;}/*** @return Collection|null*/public function getBillings(): ?Collection{return $this->billings;}/*** @param Collection|null $billings*/public function setBillings(?Collection $billings): void{$this->billings = $billings;}/*** @return string|null*/public function getDirectPhone(): ?string{return $this->directPhone;}/*** @param string|null $directPhone*/public function setDirectPhone(?string $directPhone): void{$this->directPhone = $directPhone;}/*** @return string|null*/public function getLocality(): ?string{return $this->locality;}/*** @param string|null $locality*/public function setLocality(?string $locality): void{$this->locality = $locality;}/*** @return Collection|null*/public function getCartFinished(): ?Collection{return $this->cartFinished;}/*** @param Collection|null $cartFinished*/public function setCartFinished(?Collection $cartFinished): void{$this->cartFinished = $cartFinished;}/*** @return float|null*/public function getAdditionalPercentage(): ?float{return $this->additionalPercentage;}/*** @param float|null $additionalPercentage*/public function setAdditionalPercentage(?float $additionalPercentage): void{$this->additionalPercentage = $additionalPercentage;}/*** @return Collection|null*/public function getAdditionalCompanyInformation(): ?Collection{return $this->AdditionalCompanyInformation;}/*** @param Collection|null $AdditionalCompanyInformation*/public function setAdditionalCompanyInformation(?Collection $AdditionalCompanyInformation): void{$this->AdditionalCompanyInformation = $AdditionalCompanyInformation;}/*** @return Collection|null*/public function getJoker(): ?Collection{return $this->joker;}/*** @param Collection|null $joker*/public function setJoker(?Collection $joker): void{$this->joker = $joker;}/*** @return bool|null*/public function getActive(): ?bool{return $this->active;}/*** @param bool|null $active*/public function setActive(?bool $active = false): void{$this->active = $active;}/*** @return Collection|null*/public function getDeliveryAddress(): ?Collection{return $this->deliveryAddress;}/*** @param Collection|null $deliveryAddress*/public function setDeliveryAddress(?Collection $deliveryAddress): void{$this->deliveryAddress = $deliveryAddress;}/*** @return Collection|null*/public function getTva(): ?Collection{return $this->tva;}/*** @param Collection|null $tva*/public function setTva(?Collection $tva): void{$this->tva = $tva;}/*** @return string|null*/public function getName(): ?string{return $this->name;}/*** @param string|null $name*/public function setName(?string $name): void{$this->name = $name;}/*** @return string|null*/public function getFirstName(): ?string{return $this->firstName;}/*** @param string|null $firstName*/public function setFirstName(?string $firstName): void{$this->firstName = $firstName;}/*** @return string|null*/public function getAddress(): ?string{return $this->address;}/*** @param string|null $address*/public function setAddress(?string $address): void{$this->address = $address;}/*** @return string|null*/public function getCountry(): ?string{return $this->country;}/*** @param string|null $country*/public function setCountry(?string $country): void{$this->country = $country;}/*** @return string|null*/public function getPostal(): ?string{return $this->postal;}/*** @param string|null $postal*/public function setPostal(?string $postal): void{$this->postal = $postal;}/*** @return string|null*/public function getPhoneNumber(): ?string{return $this->phoneNumber;}/*** @param string|null $phoneNumber*/public function setPhoneNumber(?string $phoneNumber): void{$this->phoneNumber = $phoneNumber;}/*** @return string|null*/public function getOtherMail(): ?string{return $this->otherMail;}/*** @param string|null $otherMail*/public function setOtherMail(?string $otherMail): void{$this->otherMail = $otherMail;}/*** @return string|null*/public function getCompanyName(): ?string{return $this->companyName;}/*** @param string|null $companyName*/public function setCompanyName(?string $companyName): void{$this->companyName = $companyName;}// /**// * @return string|null// */// public function getTypeOfProfessional(): ?string// {// return $this->typeOfProfessional;// }//// /**// * @param string|null $typeOfProfessional// */// public function setTypeOfProfessional(?string $typeOfProfessional): void// {// $this->typeOfProfessional = $typeOfProfessional;// }/*** @return Collection|null*/public function getCart(): ?Collection{return $this->cart;}/*** @param Collection|null $cart*/public function setCart(?Collection $cart): void{$this->cart = $cart;}/*** @var string The hashed password*/#[ORM\Column]private ?string $password = null;public function getId(): ?int{return $this->id;}public function getEmail(): ?string{return $this->email;}public function setEmail(string $email): self{$this->email = $email;return $this;}/*** A visual identifier that represents this user.** @see UserInterface*/public function getUserIdentifier(): string{return (string) $this->email;}/*** @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;}/*** @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 __toString(): string{return $this->email ?? '';}public function getTvaNumbersAsString(): string{$tvas = [];foreach ($this->AdditionalCompanyInformation as $info) {// Assurez-vous que l'entité AdditionalCompanyInformation a une méthode getTva()$tvas[] = $info->getTva();}return implode(", ", $tvas);}public function getCompanyNameFromAdditionalInfo(): ?string{if ($this->AdditionalCompanyInformation && $this->AdditionalCompanyInformation->count() > 0) {$firstInfo = $this->AdditionalCompanyInformation->first();return $firstInfo ? $firstInfo->getCompanyName() : null;}return null;}}