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