src/Entity/Camion.php line 13

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CamionRepository;
  4. use App\Repository\CamionUserRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. #[ORM\Entity(repositoryClassCamionRepository::class)]
  10. class Camion
  11. {
  12.     #[ORM\Id]
  13.     #[ORM\GeneratedValue]
  14.     #[ORM\Column]
  15.     private ?int $id null;
  16.     #[ORM\Column(length50)]
  17.     private ?string $nom null;
  18.     #[ORM\Column]
  19.     private ?int $actif;
  20.     #[ORM\Column]
  21.     private ?int $typeVehicule;
  22.     #[ORM\OneToMany(mappedBy'camion'targetEntityConsommationCamion::class)]
  23.     private Collection $consommationCamions;
  24.     #[ORM\OneToMany(mappedBy'camion'targetEntityCamionUser::class)]
  25.     private Collection $camionUsers;
  26.     #[ORM\OneToMany(mappedBy'camion'targetEntityCartePaiement::class)]
  27.     private Collection $cartePaiements;
  28.     #[ORM\OneToMany(mappedBy'camion'targetEntityCartePaiementCamion::class)]
  29.     private Collection $cartePaiementCamions;
  30.     #[ORM\OneToMany(mappedBy'Camion'targetEntityMaintenance::class)]
  31.     private Collection $maintenances;
  32.     #[ORM\OneToMany(mappedBy'camion'targetEntityFacture::class)]
  33.     private Collection $factures;
  34.     #[ORM\ManyToOne(inversedBy'camions')]
  35.     private ?SystemeClient $systemeClient null;
  36.     #[ORM\Column(typeTypes::DATE_MUTABLE)]
  37.     private ?\DateTimeInterface $dateImmat null;
  38.     #[ORM\OneToMany(mappedBy'voiture'targetEntityPlanningVoiture::class)]
  39.     private Collection $planningVoitures;
  40.     #[ORM\Column(length255)]
  41.     private ?string $idSamsara null;
  42.     #[ORM\Column]
  43.     private ?int $nbrEssieux null;
  44.     #[ORM\OneToMany(mappedBy'camion'targetEntityPneuVehicule::class)]
  45.     private Collection $pneuVehicules;
  46.     #[ORM\ManyToOne(inversedBy'constructeur')]
  47.     private ?Constructeur $constructeur null;
  48.     #[ORM\Column(typeTypes::DATE_MUTABLEnullabletrue)]
  49.     private ?\DateTimeInterface $finContratConstructeur null;
  50.     #[ORM\Column]
  51.     private ?int $idAddSecure null;
  52.     const TYPEVEHICULES = array(0=>'Inconnu',1=>'Tracteur',2=>'Voiture');
  53.     public function __construct()
  54.     {
  55.         $this->consommationCamions = new ArrayCollection();
  56.         $this->camionUsers = new ArrayCollection();
  57.         $this->cartePaiements = new ArrayCollection();
  58.         $this->cartePaiementCamions = new ArrayCollection();
  59.         $this->maintenances = new ArrayCollection();
  60.         $this->factures = new ArrayCollection();
  61.         $this->planningVoitures = new ArrayCollection();
  62.         $this->pneuVehicules = new ArrayCollection();
  63.     }
  64.     public function getId(): ?int
  65.     {
  66.         return $this->id;
  67.     }
  68.     public function getNom(): ?string
  69.     {
  70.         return $this->nom;
  71.     }
  72.     public function setNom(string $nom): self
  73.     {
  74.         $this->nom $nom;
  75.         return $this;
  76.     }
  77.     /**
  78.      * @return Collection<int, ConsommationCamion>
  79.      */
  80.     public function getConsommationCamions(): Collection
  81.     {
  82.         return $this->consommationCamions;
  83.     }
  84.     public function addConsommationCamion(ConsommationCamion $consommationCamion): self
  85.     {
  86.         if (!$this->consommationCamions->contains($consommationCamion)) {
  87.             $this->consommationCamions->add($consommationCamion);
  88.             $consommationCamion->setCamion($this);
  89.         }
  90.         return $this;
  91.     }
  92.     public function removeConsommationCamion(ConsommationCamion $consommationCamion): self
  93.     {
  94.         if ($this->consommationCamions->removeElement($consommationCamion)) {
  95.             // set the owning side to null (unless already changed)
  96.             if ($consommationCamion->getCamion() === $this) {
  97.                 $consommationCamion->setCamion(null);
  98.             }
  99.         }
  100.         return $this;
  101.     }
  102.     public function getActif(): ?int
  103.     {
  104.         return $this->actif;
  105.     }
  106.     public function setActif(int $actif): self
  107.     {
  108.         $this->actif $actif;
  109.         return $this;
  110.     }
  111.     public function getTypeVehicule(): ?int
  112.     {
  113.         return $this->typeVehicule;
  114.     }
  115.     public function getIconeTypeVehicule()
  116.     {
  117.         if($this->typeVehicule == 1)
  118.         {
  119.             echo "<i class=\"fa-solid fa-truck-moving\"></i>";
  120.         }
  121.         else if($this->typeVehicule == 2)
  122.         {
  123.             echo"<i class=\"fa-solid fa-car-side\"></i>";
  124.         }
  125.         else
  126.         {
  127.             echo "<i class=\"fa-solid fa-question\"></i>";
  128.         }
  129.     }
  130.     public function setTypeVehicule(int $typeVehicule): self
  131.     {
  132.         $this->typeVehicule $typeVehicule;
  133.         return $this;
  134.     }
  135.     public function getUserByDate($date): ?User
  136.     {
  137.         if(!empty($this->getCamionUsers()))
  138.         {
  139.         }
  140.         return $this->user;
  141.     }
  142.     /**
  143.      * @return Collection<int, ConsommationCamion>
  144.      */
  145.     public function getCamionUsers(): Collection
  146.     {
  147.         return $this->camionUsers;
  148.     }
  149.     public function __toString()
  150.     {
  151.         return $this->getNom();
  152.     }
  153.     /**
  154.      * @return Collection<int, CartePaiement>
  155.      */
  156.     public function getCartePaiements(): Collection
  157.     {
  158.         return $this->cartePaiements;
  159.     }
  160.     public function addCartePaiement(CartePaiement $cartePaiement): self
  161.     {
  162.         if (!$this->cartePaiements->contains($cartePaiement)) {
  163.             $this->cartePaiements->add($cartePaiement);
  164.             $cartePaiement->setCamion($this);
  165.         }
  166.         return $this;
  167.     }
  168.     public function removeCartePaiement(CartePaiement $cartePaiement): self
  169.     {
  170.         if ($this->cartePaiements->removeElement($cartePaiement)) {
  171.             // set the owning side to null (unless already changed)
  172.             if ($cartePaiement->getCamion() === $this) {
  173.                 $cartePaiement->setCamion(null);
  174.             }
  175.         }
  176.         return $this;
  177.     }
  178.     /**
  179.      * @return Collection<int, CartePaiementCamion>
  180.      */
  181.     public function getCartePaiementCamions(): Collection
  182.     {
  183.         return $this->cartePaiementCamions;
  184.     }
  185.     public function addCartePaiementCamion(CartePaiementCamion $cartePaiementCamion): self
  186.     {
  187.         if (!$this->cartePaiementCamions->contains($cartePaiementCamion)) {
  188.             $this->cartePaiementCamions->add($cartePaiementCamion);
  189.             $cartePaiementCamion->setCamion($this);
  190.         }
  191.         return $this;
  192.     }
  193.     public function removeCartePaiementCamion(CartePaiementCamion $cartePaiementCamion): self
  194.     {
  195.         if ($this->cartePaiementCamions->removeElement($cartePaiementCamion)) {
  196.             // set the owning side to null (unless already changed)
  197.             if ($cartePaiementCamion->getCamion() === $this) {
  198.                 $cartePaiementCamion->setCamion(null);
  199.             }
  200.         }
  201.         return $this;
  202.     }
  203.     /**
  204.      * @return Collection<int, CartePaiementCamion>
  205.      */
  206.     public function getCartePaiementByDate($date): Collection
  207.     {
  208.         return $this->cartePaiementCamions;
  209.     }
  210.     /**
  211.      * @return Collection<int, Maintenance>
  212.      */
  213.     public function getMaintenances(): Collection
  214.     {
  215.         return $this->maintenances;
  216.     }
  217.     public function addMaintenance(Maintenance $maintenance): self
  218.     {
  219.         if (!$this->maintenances->contains($maintenance)) {
  220.             $this->maintenances->add($maintenance);
  221.             $maintenance->setCamion($this);
  222.         }
  223.         return $this;
  224.     }
  225.     public function removeMaintenance(Maintenance $maintenance): self
  226.     {
  227.         if ($this->maintenances->removeElement($maintenance)) {
  228.             // set the owning side to null (unless already changed)
  229.             if ($maintenance->getCamion() === $this) {
  230.                 $maintenance->setCamion(null);
  231.             }
  232.         }
  233.         return $this;
  234.     }
  235.     /**
  236.      * @return Collection<int, Facture>
  237.      */
  238.     public function getFactures(): Collection
  239.     {
  240.         return $this->factures;
  241.     }
  242.     public function addFacture(Facture $facture): self
  243.     {
  244.         if (!$this->factures->contains($facture)) {
  245.             $this->factures->add($facture);
  246.             $facture->setCamion($this);
  247.         }
  248.         return $this;
  249.     }
  250.     public function removeFacture(Facture $facture): self
  251.     {
  252.         if ($this->factures->removeElement($facture)) {
  253.             // set the owning side to null (unless already changed)
  254.             if ($facture->getCamion() === $this) {
  255.                 $facture->setCamion(null);
  256.             }
  257.         }
  258.         return $this;
  259.     }
  260.     public function getSystemeClient(): ?SystemeClient
  261.     {
  262.         return $this->systemeClient;
  263.     }
  264.     public function setSystemeClient(?SystemeClient $systemeClient): self
  265.     {
  266.         $this->systemeClient $systemeClient;
  267.         return $this;
  268.     }
  269.     public function getDateImmat(): ?\DateTimeInterface
  270.     {
  271.         return $this->dateImmat;
  272.     }
  273.     public function setDateImmat(\DateTimeInterface $dateImmat): self
  274.     {
  275.         $this->dateImmat $dateImmat;
  276.         return $this;
  277.     }
  278.     /**
  279.      * @return Collection<int, PlanningVoiture>
  280.      */
  281.     public function getPlanningVoitures(): Collection
  282.     {
  283.         return $this->planningVoitures;
  284.     }
  285.     public function addPlanningVoiture(PlanningVoiture $planningVoiture): self
  286.     {
  287.         if (!$this->planningVoitures->contains($planningVoiture)) {
  288.             $this->planningVoitures->add($planningVoiture);
  289.             $planningVoiture->setVoiture($this);
  290.         }
  291.         return $this;
  292.     }
  293.     public function removePlanningVoiture(PlanningVoiture $planningVoiture): self
  294.     {
  295.         if ($this->planningVoitures->removeElement($planningVoiture)) {
  296.             // set the owning side to null (unless already changed)
  297.             if ($planningVoiture->getVoiture() === $this) {
  298.                 $planningVoiture->setVoiture(null);
  299.             }
  300.         }
  301.         return $this;
  302.     }
  303.     public function getIdSamsara(): ?string
  304.     {
  305.         return $this->idSamsara;
  306.     }
  307.     public function setIdSamsara(string $idSamsara): static
  308.     {
  309.         $this->idSamsara $idSamsara;
  310.         return $this;
  311.     }
  312.     public function getNbrEssieux(): ?int
  313.     {
  314.         return $this->nbrEssieux;
  315.     }
  316.     public function setNbrEssieux(int $nbrEssieux): static
  317.     {
  318.         $this->nbrEssieux $nbrEssieux;
  319.         return $this;
  320.     }
  321.     /**
  322.      * @return Collection<int, PneuVehicule>
  323.      */
  324.     public function getPneuVehicules(): Collection
  325.     {
  326.         return $this->pneuVehicules;
  327.     }
  328.     public function addPneuVehicule(PneuVehicule $pneuVehicule): static
  329.     {
  330.         if (!$this->pneuVehicules->contains($pneuVehicule)) {
  331.             $this->pneuVehicules->add($pneuVehicule);
  332.             $pneuVehicule->setCamion($this);
  333.         }
  334.         return $this;
  335.     }
  336.     public function removePneuVehicule(PneuVehicule $pneuVehicule): static
  337.     {
  338.         if ($this->pneuVehicules->removeElement($pneuVehicule)) {
  339.             // set the owning side to null (unless already changed)
  340.             if ($pneuVehicule->getCamion() === $this) {
  341.                 $pneuVehicule->setCamion(null);
  342.             }
  343.         }
  344.         return $this;
  345.     }
  346.     public function getConstructeur(): ?Constructeur
  347.     {
  348.         return $this->constructeur;
  349.     }
  350.     public function setConstructeur(?Constructeur $constructeur): static
  351.     {
  352.         $this->constructeur $constructeur;
  353.         return $this;
  354.     }
  355.     public function getFinContratConstructeur(): ?\DateTimeInterface
  356.     {
  357.         return $this->finContratConstructeur;
  358.     }
  359.     public function setFinContratConstructeur(?\DateTimeInterface $finContratConstructeur): static
  360.     {
  361.         $this->finContratConstructeur $finContratConstructeur;
  362.         return $this;
  363.     }
  364.     public function getIdAddSecure(): ?int
  365.     {
  366.         return $this->idAddSecure;
  367.     }
  368.     public function setIdAddSecure(int $idAddSecure): static
  369.     {
  370.         $this->idAddSecure $idAddSecure;
  371.         return $this;
  372.     }
  373. }