src/Entity/Pneu.php line 11

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\PneuRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassPneuRepository::class)]
  8. class Pneu
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     #[ORM\Column(length100)]
  15.     private ?string $matricule null;
  16.     #[ORM\Column(length100)]
  17.     private ?int $marque null;
  18.     #[ORM\OneToMany(mappedBy'pneu'targetEntityPneuVehicule::class)]
  19.     private Collection $pneuVehicules;
  20.     #[ORM\OneToMany(mappedBy'pneu'targetEntityPneuEtat::class)]
  21.     private Collection $pneuEtats;
  22.     #[ORM\Column(length10)]
  23.     private ?string $dot null;
  24.     #[ORM\Column(length100)]
  25.     private ?string $reference null;
  26.     #[ORM\Column]
  27.     private ?int $etat null;
  28.     #[ORM\Column]
  29.     private ?int $assigned null;
  30.     #[ORM\ManyToOne(inversedBy'pneus')]
  31.     private ?SystemeClient $systemeClient null;
  32.     #[ORM\ManyToOne]
  33.     private ?PneuDimension $dimension null;
  34.     #[ORM\ManyToOne]
  35.     private ?PneuProfil $profil null;
  36.     #[ORM\Column]
  37.     private ?int $actif null;
  38.     const LIST_MARQUE = array(1=>'Michelin',2=>'Autre',3=>'Bridgestone',4=>'Continenal',5=>'Dunlop',6=>'Goodyear',
  39.         7=>'Hankook',8=>'Nokicin tyres',9=>'Pirelli',10=>'Apollo',11=>'Bandag');
  40.     const LIST_ETAT = array(1=>'Neuf',2=>'Neuf recreusé',3=>'Rechapé',4=>'Rechapé recreusé');
  41.     public function __construct()
  42.     {
  43.         $this->pneuVehicules = new ArrayCollection();
  44.         $this->pneuEtats = new ArrayCollection();
  45.     }
  46.     public function getId(): ?int
  47.     {
  48.         return $this->id;
  49.     }
  50.     public function getMatricule(): ?string
  51.     {
  52.         return $this->matricule;
  53.     }
  54.     public function setMatricule(string $matricule): static
  55.     {
  56.         $this->matricule $matricule;
  57.         return $this;
  58.     }
  59.     public function getMarque(): ?int
  60.     {
  61.         return $this->marque;
  62.     }
  63.     public function setMarque(int $marque): static
  64.     {
  65.         $this->marque $marque;
  66.         return $this;
  67.     }
  68.     /**
  69.      * @return Collection<int, PneuVehicule>
  70.      */
  71.     public function getPneuVehicules(): Collection
  72.     {
  73.         return $this->pneuVehicules;
  74.     }
  75.     public function getPneuVehiculeActif()
  76.     {
  77.         $pneuVehicule null;
  78.         if(!empty($this->pneuVehicules))
  79.         {
  80.             foreach($this->pneuVehicules as $pv)
  81.             {
  82.                 if($pv->getActif()==1)
  83.                 {
  84.                     $pneuVehicule $pv;
  85.                 }
  86.             }
  87.         }
  88.         return $pneuVehicule;
  89.     }
  90.     public function addPneuVehicule(PneuVehicule $pneuVehicule): static
  91.     {
  92.         if (!$this->pneuVehicules->contains($pneuVehicule)) {
  93.             $this->pneuVehicules->add($pneuVehicule);
  94.             $pneuVehicule->setPneu($this);
  95.         }
  96.         return $this;
  97.     }
  98.     public function removePneuVehicule(PneuVehicule $pneuVehicule): static
  99.     {
  100.         if ($this->pneuVehicules->removeElement($pneuVehicule)) {
  101.             // set the owning side to null (unless already changed)
  102.             if ($pneuVehicule->getPneu() === $this) {
  103.                 $pneuVehicule->setPneu(null);
  104.             }
  105.         }
  106.         return $this;
  107.     }
  108.     /**
  109.      * @return Collection<int, PneuEtat>
  110.      */
  111.     public function getPneuEtats(): Collection
  112.     {
  113.         return $this->pneuEtats;
  114.     }
  115.     public function addPneuEtat(PneuEtat $pneuEtat): static
  116.     {
  117.         if (!$this->pneuEtats->contains($pneuEtat)) {
  118.             $this->pneuEtats->add($pneuEtat);
  119.             $pneuEtat->setPneu($this);
  120.         }
  121.         return $this;
  122.     }
  123.     public function removePneuEtat(PneuEtat $pneuEtat): static
  124.     {
  125.         if ($this->pneuEtats->removeElement($pneuEtat)) {
  126.             // set the owning side to null (unless already changed)
  127.             if ($pneuEtat->getPneu() === $this) {
  128.                 $pneuEtat->setPneu(null);
  129.             }
  130.         }
  131.         return $this;
  132.     }
  133.     public function getDot(): ?string
  134.     {
  135.         return $this->dot;
  136.     }
  137.     public function setDot(string $dot): static
  138.     {
  139.         $this->dot $dot;
  140.         return $this;
  141.     }
  142.     public function getReference(): ?string
  143.     {
  144.         return $this->reference;
  145.     }
  146.     public function setReference(string $reference): static
  147.     {
  148.         $this->reference $reference;
  149.         return $this;
  150.     }
  151.     public function getEtatIntitule(): ?string
  152.     {
  153.         return self::LIST_ETAT[$this->etat];
  154.     }
  155.     public function getEtat(): ?int
  156.     {
  157.         return $this->etat;
  158.     }
  159.     public function setEtat(int $etat): static
  160.     {
  161.         $this->etat $etat;
  162.         return $this;
  163.     }
  164.     public function getAssigned(): ?int
  165.     {
  166.         return $this->assigned;
  167.     }
  168.     public function setAssigned(int $assigned): static
  169.     {
  170.         $this->assigned $assigned;
  171.         return $this;
  172.     }
  173.     public function getSystemeClient(): ?SystemeClient
  174.     {
  175.         return $this->systemeClient;
  176.     }
  177.     public function setSystemeClient(?SystemeClient $systemeClient): static
  178.     {
  179.         $this->systemeClient $systemeClient;
  180.         return $this;
  181.     }
  182.     public function getDimension(): ?PneuDimension
  183.     {
  184.         return $this->dimension;
  185.     }
  186.     public function setDimension(?PneuDimension $dimension): static
  187.     {
  188.         $this->dimension $dimension;
  189.         return $this;
  190.     }
  191.     public function getProfil(): ?PneuProfil
  192.     {
  193.         return $this->profil;
  194.     }
  195.     public function setProfil(?PneuProfil $profil): static
  196.     {
  197.         $this->profil $profil;
  198.         return $this;
  199.     }
  200.     public function getActif(): ?int
  201.     {
  202.         return $this->actif;
  203.     }
  204.     public function setActif(int $actif): static
  205.     {
  206.         $this->actif $actif;
  207.         return $this;
  208.     }
  209. }