src/Entity/Customer/Customer.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Customer;
  3. use App\Repository\CustomerRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  6. use Symfony\Component\Security\Core\User\PasswordAuthenticatedUserInterface;
  7. use Symfony\Component\Security\Core\User\UserInterface;
  8. /**
  9.  * @ORM\Entity(repositoryClass=CustomerRepository::class)
  10.  * @UniqueEntity(fields={"email"}, message="Un compte est déjà associé à ce mail")
  11.  */
  12. class Customer implements UserInterfacePasswordAuthenticatedUserInterface
  13. {
  14.     /**
  15.      * @ORM\Id
  16.      * @ORM\GeneratedValue
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="json")
  22.      */
  23.     private $roles = [];
  24.     /**
  25.      * @ORM\Column(type="string", length=255, nullable=true)
  26.      */
  27.     private $password;
  28.     /**
  29.      * @ORM\Column(type="string", length=255, nullable=true)
  30.      */
  31.     private $company;
  32.     /**
  33.      * @ORM\Column(type="string", length=14, nullable=true)
  34.      */
  35.     private $customerNumber;
  36.     /**
  37.      * @ORM\Column(type="string", length=255)
  38.      */
  39.     private $firstname;
  40.     /**
  41.      * @ORM\Column(type="string", length=255)
  42.      */
  43.     private $lastname;
  44.     /**
  45.      * @ORM\Column(type="string", length=255)
  46.      */
  47.     private $email;
  48.     /**
  49.      * @ORM\Column(type="string", length=255, nullable=true)
  50.      */
  51.     private $phone;
  52.     /**
  53.      * @ORM\Column(type="string", length=32, nullable=true)
  54.      */
  55.     private $phoneMobile;
  56.     /**
  57.      * @ORM\Column(type="string", length=255, nullable=true)
  58.      */
  59.     private $address1;
  60.     /**
  61.      * @ORM\Column(type="string", length=255, nullable=true)
  62.      */
  63.     private $address2;
  64.     /**
  65.      * @ORM\Column(type="string", length=12, nullable=true)
  66.      */
  67.     private $postcode;
  68.     /**
  69.      * @ORM\Column(type="string", length=64, nullable=true)
  70.      */
  71.     private $city;
  72.     /**
  73.      * @ORM\Column(type="string", length=64, nullable=true)
  74.      */
  75.     private $country;
  76.     /**
  77.      * @ORM\Column(type="date", nullable=true)
  78.      */
  79.     private $birthday;
  80.     /**
  81.      * @ORM\Column(type="boolean", nullable=true)
  82.      */
  83.     private $gender;
  84.     /**
  85.      * @ORM\Column(type="float", nullable=true)
  86.      */
  87.     private $solde;
  88.     /**
  89.      * @ORM\Column(type="datetime", nullable=true)
  90.      */
  91.     private $dateAdd;
  92.     /**
  93.      * @ORM\Column(type="datetime", nullable=true)
  94.      */
  95.     private $dateUpd;
  96.     /**
  97.      * @ORM\Column(type="text", nullable=true)
  98.      */
  99.     private $comment;
  100.     /**
  101.      * @ORM\Column(type="string", length=128, nullable=true)
  102.      */
  103.     private $statut;
  104.     /**
  105.      * @ORM\Column(type="string", length=128, nullable=true)
  106.      */
  107.     private $centrePrefere//centre_prefere
  108.     /**
  109.      * @ORM\Column(type="boolean", nullable=true)
  110.      */
  111.     private $active;
  112.     /**
  113.      * @ORM\Column(type="boolean", nullable=true)
  114.      */
  115.     private $deleted;
  116.     /**
  117.      * @ORM\Column(type="string", length=255, nullable=true)
  118.      */
  119.     private $resetToken;
  120.     public function __toString()
  121.     {
  122.         return $this->firstname.' '.$this->lastname.' ('.str_pad(($this->id),6,"0"STR_PAD_LEFT).')';
  123.     }
  124.     public function getId(): ?int
  125.     {
  126.         return $this->id;
  127.     }
  128.     /**
  129.      * @deprecated since Symfony 5.3, use getUserIdentifier instead
  130.      */
  131.     public function getUsername(): string
  132.     {
  133.         return (string) $this->email;
  134.     }
  135.     /**
  136.      * @see UserInterface
  137.      */
  138.     public function getRoles(): array
  139.     {
  140.         $roles $this->roles;
  141.         // guarantee every user at least has ROLE_USER
  142.         $roles[] = 'ROLE_CUSTOMER';
  143.         return array_unique($roles);
  144.     }
  145.     public function setRoles(array $roles): self
  146.     {
  147.         $this->roles $roles;
  148.         return $this;
  149.     }
  150.     /**
  151.      * @see PasswordAuthenticatedUserInterface
  152.      */
  153.     public function getPassword(): ?string
  154.     {
  155.         return $this->password;
  156.     }
  157.     public function setPassword(string $password): self
  158.     {
  159.         $this->password $password;
  160.         return $this;
  161.     }
  162.     /**
  163.      * Returning a salt is only needed, if you are not using a modern
  164.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  165.      *
  166.      * @see UserInterface
  167.      */
  168.     public function getSalt(): ?string
  169.     {
  170.         return null;
  171.     }
  172.     /**
  173.      * @see UserInterface
  174.      */
  175.     public function eraseCredentials()
  176.     {
  177.         // If you store any temporary, sensitive data on the user, clear it here
  178.         // $this->plainPassword = null;
  179.     }
  180.     public function getCompany(): ?string
  181.     {
  182.         return $this->company;
  183.     }
  184.     public function setCompany(?string $company): self
  185.     {
  186.         $this->company $company;
  187.         return $this;
  188.     }
  189.     public function getCustomerNumber(): ?string
  190.     {
  191.         return $this->customerNumber;
  192.     }
  193.     public function setCustomerNumber(?string $customerNumber): self
  194.     {
  195.         $this->customerNumber $customerNumber;
  196.         return $this;
  197.     }
  198.     public function getFirstname(): ?string
  199.     {
  200.         return $this->firstname;
  201.     }
  202.     public function setFirstname(string $firstname): self
  203.     {
  204.         $this->firstname $firstname;
  205.         return $this;
  206.     }
  207.     public function getLastname(): ?string
  208.     {
  209.         return $this->lastname;
  210.     }
  211.     public function setLastname(string $lastname): self
  212.     {
  213.         $this->lastname $lastname;
  214.         return $this;
  215.     }
  216.     public function getEmail(): ?string
  217.     {
  218.         return $this->email;
  219.     }
  220.     public function setEmail(string $email): self
  221.     {
  222.         $this->email $email;
  223.         return $this;
  224.     }
  225.     public function getPhone(): ?string
  226.     {
  227.         return $this->phone;
  228.     }
  229.     public function setPhone(?string $phone): self
  230.     {
  231.         $this->phone $phone;
  232.         return $this;
  233.     }
  234.     public function getPhoneMobile(): ?string
  235.     {
  236.         return $this->phoneMobile;
  237.     }
  238.     public function setPhoneMobile(?string $phoneMobile): self
  239.     {
  240.         $this->phoneMobile $phoneMobile;
  241.         return $this;
  242.     }
  243.     public function getAddress1(): ?string
  244.     {
  245.         return $this->address1;
  246.     }
  247.     public function setAddress1(?string $address1): self
  248.     {
  249.         $this->address1 $address1;
  250.         return $this;
  251.     }
  252.     public function getAddress2(): ?string
  253.     {
  254.         return $this->address2;
  255.     }
  256.     public function setAddress2(?string $address2): self
  257.     {
  258.         $this->address2 $address2;
  259.         return $this;
  260.     }
  261.     public function getPostcode(): ?string
  262.     {
  263.         return $this->postcode;
  264.     }
  265.     public function setPostcode(?string $postcode): self
  266.     {
  267.         $this->postcode $postcode;
  268.         return $this;
  269.     }
  270.     public function getCity(): ?string
  271.     {
  272.         return $this->city;
  273.     }
  274.     public function setCity(?string $city): self
  275.     {
  276.         $this->city $city;
  277.         return $this;
  278.     }
  279.     public function getCountry(): ?string
  280.     {
  281.         return $this->country;
  282.     }
  283.     public function setCountry(?string $country): self
  284.     {
  285.         $this->country $country;
  286.         return $this;
  287.     }
  288.     public function getBirthday(): ?\DateTimeInterface
  289.     {
  290.         return $this->birthday;
  291.     }
  292.     public function setBirthday(?\DateTimeInterface $birthday): self
  293.     {
  294.         $this->birthday $birthday;
  295.         return $this;
  296.     }
  297.     public function getGender(): ?bool
  298.     {
  299.         return $this->gender;
  300.     }
  301.     public function setGender(?bool $gender): self
  302.     {
  303.         $this->gender $gender;
  304.         return $this;
  305.     }
  306.     public function getSolde(): ?float
  307.     {
  308.         return $this->solde;
  309.     }
  310.     public function setSolde(?float $solde): self
  311.     {
  312.         $this->solde $solde;
  313.         return $this;
  314.     }
  315.     public function getDateAdd(): ?\DateTimeInterface
  316.     {
  317.         return $this->dateAdd;
  318.     }
  319.     public function setDateAdd(?\DateTimeInterface $dateAdd): self
  320.     {
  321.         $this->dateAdd $dateAdd;
  322.         return $this;
  323.     }
  324.     public function getDateUpd(): ?\DateTimeInterface
  325.     {
  326.         return $this->dateUpd;
  327.     }
  328.     public function setDateUpd(?\DateTimeInterface $dateUpd): self
  329.     {
  330.         $this->dateUpd $dateUpd;
  331.         return $this;
  332.     }
  333.     public function getComment(): ?string
  334.     {
  335.         return $this->comment;
  336.     }
  337.     public function setComment(?string $comment): self
  338.     {
  339.         $this->comment $comment;
  340.         return $this;
  341.     }
  342.     public function getStatut(): ?string
  343.     {
  344.         return $this->statut;
  345.     }
  346.     public function setStatut(?string $statut): self
  347.     {
  348.         $this->statut $statut;
  349.         return $this;
  350.     }
  351.     public function getCentrePrefere(): ?string
  352.     {
  353.         return $this->centrePrefere;
  354.     }
  355.     public function setCentrePrefere(?string $centrePrefere): self
  356.     {
  357.         $this->centrePrefere $centrePrefere;
  358.         return $this;
  359.     }
  360.     public function getActive(): ?bool
  361.     {
  362.         return $this->active;
  363.     }
  364.     public function setActive(?bool $active): self
  365.     {
  366.         $this->active $active;
  367.         return $this;
  368.     }
  369.     public function getDeleted(): ?bool
  370.     {
  371.         return $this->deleted;
  372.     }
  373.     public function setDeleted(?bool $deleted): self
  374.     {
  375.         $this->deleted $deleted;
  376.         return $this;
  377.     }
  378.     public function getResetToken(): ?string
  379.     {
  380.         return $this->resetToken;
  381.     }
  382.     public function setResetToken(?string $resetToken): self
  383.     {
  384.         $this->resetToken $resetToken;
  385.         return $this;
  386.     }
  387. }