src/Entity/Client.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Symfony\Component\HttpFoundation\File\File;
  7. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  8. /**
  9.  * @ORM\Entity(repositoryClass="App\Repository\ClientRepository")
  10.  * @Vich\Uploadable
  11.  */
  12. class Client
  13. {
  14.     /**
  15.      * @ORM\Id()
  16.      * @ORM\GeneratedValue()
  17.      * @ORM\Column(type="integer")
  18.      */
  19.     private $id;
  20.     /**
  21.      * @ORM\Column(type="string", length=6, nullable=true)
  22.      */
  23.     private $numClient;
  24.     /**
  25.      * @ORM\Column(type="string", length=50)
  26.      */
  27.     private $nom;
  28.     /**
  29.      * @ORM\Column(type="string", length=255)
  30.      */
  31.     private $prenom;
  32.     /**
  33.      * @ORM\Column(type="string", length=50)
  34.      */
  35.     private $email;
  36.     /**
  37.      * @ORM\Column(type="integer")
  38.      */
  39.     private $telephone;
  40.     /**
  41.      * @ORM\Column(type="string", length=255)
  42.      */
  43.     private $adresse;
  44.     /**
  45.      * @ORM\Column(type="string", length=255, nullable=true)
  46.      */
  47.     private $photoProfil;
  48.     /**
  49.      * @Vich\UploadableField(mapping="client_upload", fileNameProperty="photoProfil")
  50.      * @var File
  51.      */
  52.     private $photoProfilFile;
  53.     /**
  54.      * @ORM\OneToMany(targetEntity="App\Entity\Vente", mappedBy="client", orphanRemoval=true)
  55.      */
  56.     private $ventes;
  57.     private $clientInput;
  58.     private $numero;
  59.     public function __construct()
  60.     {
  61.         $this->ventes = new ArrayCollection();
  62.     }
  63.     public function getId(): ?int
  64.     {
  65.         return $this->id;
  66.     }
  67.     public function getNom(): ?string
  68.     {
  69.         return $this->nom;
  70.     }
  71.     public function setNom(string $nom): self
  72.     {
  73.         $this->nom $nom;
  74.         return $this;
  75.     }
  76.     public function getPrenom(): ?string
  77.     {
  78.         return $this->prenom;
  79.     }
  80.     public function setPrenom(string $prenom): self
  81.     {
  82.         $this->prenom $prenom;
  83.         return $this;
  84.     }
  85.     public function getEmail(): ?string
  86.     {
  87.         return $this->email;
  88.     }
  89.     public function setEmail(string $email): self
  90.     {
  91.         $this->email $email;
  92.         return $this;
  93.     }
  94.     public function getTelephone(): ?int
  95.     {
  96.         return $this->telephone;
  97.     }
  98.     public function setTelephone(int $telephone): self
  99.     {
  100.         $this->telephone $telephone;
  101.         return $this;
  102.     }
  103.     public function getAdresse(): ?string
  104.     {
  105.         return $this->adresse;
  106.     }
  107.     public function setAdresse(string $adresse): self
  108.     {
  109.         $this->adresse $adresse;
  110.         return $this;
  111.     }
  112.     public function getPhotoProfil(): ?string
  113.     {
  114.         return $this->photoProfil;
  115.     }
  116.     public function setPhotoProfil(string $photoProfil null): self
  117.     {
  118.         $this->photoProfil $photoProfil;
  119.         return $this;
  120.     }
  121.     public function setPhotoProfilFile(File $photoProfilFile null)
  122.     {
  123.         $this->photoProfilFile $photoProfilFile;
  124.     }
  125.     public function getPhotoProfilFile()
  126.     {
  127.         return $this->photoProfilFile;
  128.     }
  129.     /**
  130.      * @return Collection|Vente[]
  131.      */
  132.     public function getVentes(): Collection
  133.     {
  134.         return $this->ventes;
  135.     }
  136.     public function addVente(Vente $vente): self
  137.     {
  138.         if (!$this->ventes->contains($vente)) {
  139.             $this->ventes[] = $vente;
  140.             $vente->setClient($this);
  141.         }
  142.         return $this;
  143.     }
  144.     public function removeVente(Vente $vente): self
  145.     {
  146.         if ($this->ventes->contains($vente)) {
  147.             $this->ventes->removeElement($vente);
  148.             // set the owning side to null (unless already changed)
  149.             if ($vente->getClient() === $this) {
  150.                 $vente->setClient(null);
  151.             }
  152.         }
  153.         return $this;
  154.     }
  155.     public function __toString()
  156.     {
  157.         return $this->nom ' ' $this->prenom;
  158.     }
  159.     /**
  160.      * Get the value of clientInput
  161.      */
  162.     public function getClientInput()
  163.     {
  164.         return $this->nom ' ' $this->prenom;
  165.     }
  166.     /**
  167.      * Get the value of numClient
  168.      */
  169.     public function getNumClient()
  170.     {
  171.         $prefix 'CL';
  172.         $id $this->id;
  173.         return ($id 10 ) ? ($prefix '0' $this->id) : ($prefix $this->id);
  174.     }
  175.     /**
  176.      * Set the value of numClient
  177.      *
  178.      * @return  self
  179.      */
  180.     public function setNumClient($numClient)
  181.     {
  182.         $this->numClient $numClient;
  183.         return $this;
  184.     }
  185.     /**
  186.      * Get the value of numero
  187.      *
  188.      * @return  self
  189.      */
  190.     public function getNumero()
  191.     {
  192.         $prefix 'CL';
  193.         $id $this->id;
  194.         return ($id 10 ) ? ($prefix '0' $this->id) : ($prefix $this->id);
  195.     }
  196. }