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="boolean", nullable=true)
  106.      */
  107.     private $active;
  108.     /**
  109.      * @ORM\Column(type="boolean", nullable=true)
  110.      */
  111.     private $deleted;
  112.     /**
  113.      * @ORM\Column(type="string", length=255, nullable=true)
  114.      */
  115.     private $resetToken;
  116.     public function __toString()
  117.     {
  118.         return $this->firstname.' '.$this->lastname.' ('.str_pad(($this->id),6,"0"STR_PAD_LEFT).')';
  119.     }
  120.     public function getId(): ?int
  121.     {
  122.         return $this->id;
  123.     }
  124.     /**
  125.      * @deprecated since Symfony 5.3, use getUserIdentifier instead
  126.      */
  127.     public function getUsername(): string
  128.     {
  129.         return (string) $this->email;
  130.     }
  131.     /**
  132.      * @see UserInterface
  133.      */
  134.     public function getRoles(): array
  135.     {
  136.         $roles $this->roles;
  137.         // guarantee every user at least has ROLE_USER
  138.         $roles[] = 'ROLE_CUSTOMER';
  139.         return array_unique($roles);
  140.     }
  141.     public function setRoles(array $roles): self
  142.     {
  143.         $this->roles $roles;
  144.         return $this;
  145.     }
  146.     /**
  147.      * @see PasswordAuthenticatedUserInterface
  148.      */
  149.     public function getPassword(): ?string
  150.     {
  151.         return $this->password;
  152.     }
  153.     public function setPassword(string $password): self
  154.     {
  155.         $this->password $password;
  156.         return $this;
  157.     }
  158.     /**
  159.      * Returning a salt is only needed, if you are not using a modern
  160.      * hashing algorithm (e.g. bcrypt or sodium) in your security.yaml.
  161.      *
  162.      * @see UserInterface
  163.      */
  164.     public function getSalt(): ?string
  165.     {
  166.         return null;
  167.     }
  168.     /**
  169.      * @see UserInterface
  170.      */
  171.     public function eraseCredentials()
  172.     {
  173.         // If you store any temporary, sensitive data on the user, clear it here
  174.         // $this->plainPassword = null;
  175.     }
  176.     public function getCompany(): ?string
  177.     {
  178.         return $this->company;
  179.     }
  180.     public function setCompany(?string $company): self
  181.     {
  182.         $this->company $company;
  183.         return $this;
  184.     }
  185.     public function getCustomerNumber(): ?string
  186.     {
  187.         return $this->customerNumber;
  188.     }
  189.     public function setCustomerNumber(?string $customerNumber): self
  190.     {
  191.         $this->customerNumber $customerNumber;
  192.         return $this;
  193.     }
  194.     public function getFirstname(): ?string
  195.     {
  196.         return $this->firstname;
  197.     }
  198.     public function setFirstname(string $firstname): self
  199.     {
  200.         $this->firstname $firstname;
  201.         return $this;
  202.     }
  203.     public function getLastname(): ?string
  204.     {
  205.         return $this->lastname;
  206.     }
  207.     public function setLastname(string $lastname): self
  208.     {
  209.         $this->lastname $lastname;
  210.         return $this;
  211.     }
  212.     public function getEmail(): ?string
  213.     {
  214.         return $this->email;
  215.     }
  216.     public function setEmail(string $email): self
  217.     {
  218.         $this->email $email;
  219.         return $this;
  220.     }
  221.     public function getPhone(): ?string
  222.     {
  223.         return $this->phone;
  224.     }
  225.     public function setPhone(?string $phone): self
  226.     {
  227.         $this->phone $phone;
  228.         return $this;
  229.     }
  230.     public function getPhoneMobile(): ?string
  231.     {
  232.         return $this->phoneMobile;
  233.     }
  234.     public function setPhoneMobile(?string $phoneMobile): self
  235.     {
  236.         $this->phoneMobile $phoneMobile;
  237.         return $this;
  238.     }
  239.     public function getAddress1(): ?string
  240.     {
  241.         return $this->address1;
  242.     }
  243.     public function setAddress1(?string $address1): self
  244.     {
  245.         $this->address1 $address1;
  246.         return $this;
  247.     }
  248.     public function getAddress2(): ?string
  249.     {
  250.         return $this->address2;
  251.     }
  252.     public function setAddress2(?string $address2): self
  253.     {
  254.         $this->address2 $address2;
  255.         return $this;
  256.     }
  257.     public function getPostcode(): ?string
  258.     {
  259.         return $this->postcode;
  260.     }
  261.     public function setPostcode(?string $postcode): self
  262.     {
  263.         $this->postcode $postcode;
  264.         return $this;
  265.     }
  266.     public function getCity(): ?string
  267.     {
  268.         return $this->city;
  269.     }
  270.     public function setCity(?string $city): self
  271.     {
  272.         $this->city $city;
  273.         return $this;
  274.     }
  275.     public function getCountry(): ?string
  276.     {
  277.         return $this->country;
  278.     }
  279.     public function setCountry(?string $country): self
  280.     {
  281.         $this->country $country;
  282.         return $this;
  283.     }
  284.     public function getBirthday(): ?\DateTimeInterface
  285.     {
  286.         return $this->birthday;
  287.     }
  288.     public function setBirthday(?\DateTimeInterface $birthday): self
  289.     {
  290.         $this->birthday $birthday;
  291.         return $this;
  292.     }
  293.     public function getGender(): ?bool
  294.     {
  295.         return $this->gender;
  296.     }
  297.     public function setGender(?bool $gender): self
  298.     {
  299.         $this->gender $gender;
  300.         return $this;
  301.     }
  302.     public function getSolde(): ?float
  303.     {
  304.         return $this->solde;
  305.     }
  306.     public function setSolde(?float $solde): self
  307.     {
  308.         $this->solde $solde;
  309.         return $this;
  310.     }
  311.     public function getDateAdd(): ?\DateTimeInterface
  312.     {
  313.         return $this->dateAdd;
  314.     }
  315.     public function setDateAdd(?\DateTimeInterface $dateAdd): self
  316.     {
  317.         $this->dateAdd $dateAdd;
  318.         return $this;
  319.     }
  320.     public function getDateUpd(): ?\DateTimeInterface
  321.     {
  322.         return $this->dateUpd;
  323.     }
  324.     public function setDateUpd(?\DateTimeInterface $dateUpd): self
  325.     {
  326.         $this->dateUpd $dateUpd;
  327.         return $this;
  328.     }
  329.     public function getComment(): ?string
  330.     {
  331.         return $this->comment;
  332.     }
  333.     public function setComment(?string $comment): self
  334.     {
  335.         $this->comment $comment;
  336.         return $this;
  337.     }
  338.     public function getStatut(): ?string
  339.     {
  340.         return $this->statut;
  341.     }
  342.     public function setStatut(?string $statut): self
  343.     {
  344.         $this->statut $statut;
  345.         return $this;
  346.     }
  347.     public function getActive(): ?bool
  348.     {
  349.         return $this->active;
  350.     }
  351.     public function setActive(?bool $active): self
  352.     {
  353.         $this->active $active;
  354.         return $this;
  355.     }
  356.     public function getDeleted(): ?bool
  357.     {
  358.         return $this->deleted;
  359.     }
  360.     public function setDeleted(?bool $deleted): self
  361.     {
  362.         $this->deleted $deleted;
  363.         return $this;
  364.     }
  365.     public function getResetToken(): ?string
  366.     {
  367.         return $this->resetToken;
  368.     }
  369.     public function setResetToken(?string $resetToken): self
  370.     {
  371.         $this->resetToken $resetToken;
  372.         return $this;
  373.     }
  374. }