src/Entity/TableauMesure.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TableauMesureRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\HttpFoundation\File\File;
  8. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  9. /**
  10.  * @Vich\Uploadable
  11.  */
  12. #[ORM\Entity(repositoryClassTableauMesureRepository::class)]
  13. class TableauMesure
  14. {
  15.     #[ORM\Id]
  16.     #[ORM\GeneratedValue]
  17.     #[ORM\Column(type'integer')]
  18.     private $id;
  19.     #[ORM\Column(type'string'length255nullabletrue)]
  20.     private $reference;
  21.     #[ORM\ManyToOne(targetEntityBonnet::class, inversedBy'tableauMesures')]
  22.     private $bonnet;
  23.     #[ORM\ManyToMany(targetEntityTaille::class, inversedBy'tableauMesures')]
  24.     private $tailles;
  25.     #[ORM\Column(type'datetime'nullabletrue)]
  26.     private $date_creation;
  27.     #[ORM\Column(type'text'nullabletrue)]
  28.     private $commentaire;
  29.     #[ORM\OneToMany(targetEntityTableauMesureTermine::class, mappedBy'tableauMesure'cascade: ['persist''remove'])]
  30.     private $mesures_termine;
  31.     #[ORM\OneToMany(targetEntityTableauMesureEnCours::class, mappedBy'tableauMesure'cascade: ['persist''remove'])]
  32.     private $mesures_en_cours;
  33.     #[ORM\Column(type'datetime'nullabletrue)]
  34.     private $date_update;
  35.     /**
  36.      * @Vich\UploadableField(mapping="tableauMesure", fileNameProperty="image1")
  37.      */
  38.     private ?\Symfony\Component\HttpFoundation\File\File $fichier1 null;
  39.     #[ORM\Column(type'string'length255nullabletrue)]
  40.     private $image1;
  41.     /**
  42.      * @Vich\UploadableField(mapping="tableauMesure", fileNameProperty="image2")
  43.      */
  44.     private ?\Symfony\Component\HttpFoundation\File\File $fichier2 null;
  45.     #[ORM\Column(type'string'length255nullabletrue)]
  46.     private $image2;
  47.     public function __clone()
  48.     {
  49.        if ($this->id) {
  50.             $this->id null;
  51.                                                                                     
  52.             $mesuresTermineCollection = new ArrayCollection();                   
  53.             foreach ($this->mesures_termine as $termine) {                             
  54.                 $termineClone = clone $termine
  55.                 $termineClone->setTableauMesure($this);                             
  56.                 $mesuresTermineCollection->add($termineClone);                   
  57.             }                                                               
  58.             $this->mesures_termine $mesuresTermineCollection
  59.             $mesuresEnCoursCollection = new ArrayCollection();                   
  60.             foreach ($this->mesures_en_cours as $mesure) {                             
  61.                 $mesureClone = clone $mesure
  62.                 $mesureClone->setTableauMesure($this);                             
  63.                 $mesuresEnCoursCollection->add($mesureClone);                   
  64.             }                                                               
  65.             $this->mesures_en_cours $mesuresEnCoursCollection
  66.             return $this;
  67.         }
  68.     }
  69.     public function __construct()
  70.     {
  71.         $this->tailles = new ArrayCollection();
  72.         $this->date_creation = new \DateTime;
  73.         $this->mesures_termine = new ArrayCollection();
  74.         $this->mesures_en_cours = new ArrayCollection();
  75.     }
  76.     public function setFichier2(File $file null)
  77.     {
  78.         $this->fichier2 $file;
  79.         if ($file) {
  80.             $this->date_update = new \DateTime;
  81.         }
  82.     }
  83.     public function getFichier2()
  84.     {
  85.         return $this->fichier2;
  86.     }
  87.     public function setFichier1(File $file null)
  88.     {
  89.         $this->fichier1 $file;
  90.         if ($file) {
  91.             $this->date_update = new \DateTime;
  92.         }
  93.     }
  94.     public function getFichier1()
  95.     {
  96.         return $this->fichier1;
  97.     }
  98.     public function getId(): ?int
  99.     {
  100.         return $this->id;
  101.     }
  102.     public function getReference(): ?string
  103.     {
  104.         return $this->reference;
  105.     }
  106.     public function setReference(?string $reference): self
  107.     {
  108.         $this->reference $reference;
  109.         return $this;
  110.     }
  111.     public function getBonnet(): ?Bonnet
  112.     {
  113.         return $this->bonnet;
  114.     }
  115.     public function setBonnet(?Bonnet $bonnet): self
  116.     {
  117.         $this->bonnet $bonnet;
  118.         return $this;
  119.     }
  120.     /**
  121.      * @return Collection|Taille[]
  122.      */
  123.     public function getTailles(): Collection
  124.     {
  125.         return $this->tailles;
  126.     }
  127.     public function addTaille(Taille $taille): self
  128.     {
  129.         if (!$this->tailles->contains($taille)) {
  130.             $this->tailles[] = $taille;
  131.         }
  132.         return $this;
  133.     }
  134.     public function removeTaille(Taille $taille): self
  135.     {
  136.         $this->tailles->removeElement($taille);
  137.         return $this;
  138.     }
  139.     public function getDateCreation(): ?\DateTimeInterface
  140.     {
  141.         return $this->date_creation;
  142.     }
  143.     public function setDateCreation(?\DateTimeInterface $date_creation): self
  144.     {
  145.         $this->date_creation $date_creation;
  146.         return $this;
  147.     }
  148.     public function getCommentaire(): ?string
  149.     {
  150.         return $this->commentaire;
  151.     }
  152.     public function setCommentaire(?string $commentaire): self
  153.     {
  154.         $this->commentaire $commentaire;
  155.         return $this;
  156.     }
  157.     /**
  158.      * @return Collection|TableauMesureTermine[]
  159.      */
  160.     public function getMesuresTermine(): Collection
  161.     {
  162.         return $this->mesures_termine;
  163.     }
  164.     public function addMesureTermine(TableauMesureTermine $mesure): self
  165.     {
  166.         if (!$this->mesures_termine->contains($mesure)) {
  167.             $this->mesures_termine[] = $mesure;
  168.             $mesure->setTableauMesure($this);
  169.         }
  170.         return $this;
  171.     }
  172.     public function removeMesureTermine(TableauMesureTermine $mesure): self
  173.     {
  174.         if ($this->mesures_termine->removeElement($mesure)) {
  175.             // set the owning side to null (unless already changed)
  176.             if ($mesure->getTableauMesure() === $this) {
  177.                 $mesure->setTableauMesure(null);
  178.             }
  179.         }
  180.         return $this;
  181.     }
  182.     public function getDateUpdate(): ?\DateTimeInterface
  183.     {
  184.         return $this->date_update;
  185.     }
  186.     public function setDateUpdate(?\DateTimeInterface $date_update): self
  187.     {
  188.         $this->date_update $date_update;
  189.         return $this;
  190.     }
  191.     /**
  192.      * @return Collection|TableauMesureEnCours[]
  193.      */
  194.     public function getMesuresEnCours(): Collection
  195.     {
  196.         return $this->mesures_en_cours;
  197.     }
  198.     public function addMesureEnCours(TableauMesureEnCours $mesure): self
  199.     {
  200.         if (!$this->mesures_en_cours->contains($mesure)) {
  201.             $this->mesures_en_cours[] = $mesure;
  202.             $mesure->setTableauMesure($this);
  203.         }
  204.         return $this;
  205.     }
  206.     public function removeMesureEnCours(TableauMesureEnCours $mesure): self
  207.     {
  208.         if ($this->mesures_en_cours->removeElement($mesure)) {
  209.             // set the owning side to null (unless already changed)
  210.             if ($mesure->getTableauMesure() === $this) {
  211.                 $mesure->setTableauMesure(null);
  212.             }
  213.         }
  214.         return $this;
  215.     }
  216.     public function getImage1(): ?string
  217.     {
  218.         return $this->image1;
  219.     }
  220.     public function setImage1(?string $image1): self
  221.     {
  222.         $this->image1 $image1;
  223.         return $this;
  224.     }
  225.     public function getImage2(): ?string
  226.     {
  227.         return $this->image2;
  228.     }
  229.     public function setImage2(?string $image2): self
  230.     {
  231.         $this->image2 $image2;
  232.         return $this;
  233.     }
  234. }