src/Entity/TableauMesureTermine.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\TableauMesureTermineRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassTableauMesureTermineRepository::class)]
  8. class TableauMesureTermine
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column(type'integer')]
  13.     private $id;
  14.     #[ORM\ManyToOne(targetEntityTableauMesureLibelle::class, inversedBy'tableauMesureTermine')]
  15.     private $mesure;
  16.     #[ORM\Column(type'float'nullabletrue)]
  17.     private $tolerance;
  18.     #[ORM\ManyToOne(targetEntityTableauMesure::class, inversedBy'mesures_termine')]
  19.     private $tableauMesure;
  20.     #[ORM\OneToMany(targetEntityTableauMesureTermineValeur::class, mappedBy'tableauMesureTermine'cascade: ['persist''remove'])]
  21.     private $valeurs;
  22.     #[ORM\Column(type'string'length255nullabletrue)]
  23.     private $numero;
  24.     public function __clone(){
  25.         if ($this->id) {
  26.             $this->id null;
  27.                                                                                     
  28.             $valeursCollection = new ArrayCollection();                   
  29.             foreach ($this->valeurs as $valeur) {                             
  30.                 $valeurClone = clone $valeur
  31.                 $valeurClone->setTableauMesureTermine($this);                             
  32.                 $valeursCollection->add($valeurClone);                   
  33.             }                                                               
  34.             $this->valeurs $valeursCollection
  35.             return $this;
  36.         }
  37.     }
  38.     public function __construct()
  39.     {
  40.         $this->valeurs = new ArrayCollection();
  41.     }
  42.     public function getId(): ?int
  43.     {
  44.         return $this->id;
  45.     }
  46.     public function getMesure(): ?TableauMesureLibelle
  47.     {
  48.         return $this->mesure;
  49.     }
  50.     public function setMesure(?TableauMesureLibelle $mesure): self
  51.     {
  52.         $this->mesure $mesure;
  53.         return $this;
  54.     }
  55.     public function getTolerance(): ?float
  56.     {
  57.         return $this->tolerance;
  58.     }
  59.     public function setTolerance(?float $tolerance): self
  60.     {
  61.         $this->tolerance $tolerance;
  62.         return $this;
  63.     }
  64.     public function getTableauMesure(): ?TableauMesure
  65.     {
  66.         return $this->tableauMesure;
  67.     }
  68.     public function setTableauMesure(?TableauMesure $tableauMesure): self
  69.     {
  70.         $this->tableauMesure $tableauMesure;
  71.         return $this;
  72.     }
  73.     /**
  74.      * @return Collection|TableauMesureTermineValeur[]
  75.      */
  76.     public function getValeurs(): Collection
  77.     {
  78.         return $this->valeurs;
  79.     }
  80.     public function addValeur(TableauMesureTermineValeur $valeur): self
  81.     {
  82.         if (!$this->valeurs->contains($valeur)) {
  83.             $this->valeurs[] = $valeur;
  84.             $valeur->setTableauMesureTermine($this);
  85.         }
  86.         return $this;
  87.     }
  88.     public function removeValeur(TableauMesureTermineValeur $valeur): self
  89.     {
  90.         if ($this->valeurs->removeElement($valeur)) {
  91.             // set the owning side to null (unless already changed)
  92.             if ($valeur->getTableauMesureTermine() === $this) {
  93.                 $valeur->setTableauMesureTermine(null);
  94.             }
  95.         }
  96.         return $this;
  97.     }
  98.     public function getNumero(): ?string
  99.     {
  100.         return $this->numero;
  101.     }
  102.     public function setNumero(?string $numero): self
  103.     {
  104.         $this->numero $numero;
  105.         return $this;
  106.     }
  107. }