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