src/Entity/DeclarationChauffeur.php line 10

  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DeclarationChauffeurRepository;
  4. use Doctrine\DBAL\Types\Types;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassDeclarationChauffeurRepository::class)]
  7. class DeclarationChauffeur
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column]
  12.     private ?int $id null;
  13.     #[ORM\Column(typeTypes::DATE_MUTABLE)]
  14.     private ?\DateTimeInterface $date null;
  15.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  16.     private ?\DateTimeInterface $heureDepart null;
  17.     #[ORM\Column(typeTypes::DATETIME_MUTABLE)]
  18.     private ?\DateTimeInterface $heureArrivee null;
  19.     #[ORM\ManyToOne]
  20.     private ?VilleFrance $villeDepart null;
  21.     #[ORM\ManyToOne]
  22.     private ?VilleFrance $villeArrivee null;
  23.     #[ORM\Column]
  24.     private ?bool $pdj null;
  25.     #[ORM\Column]
  26.     private ?bool $rmidi null;
  27.     #[ORM\Column]
  28.     private ?bool $rsoir null;
  29.     #[ORM\Column]
  30.     private ?bool $rgd null;
  31.     #[ORM\Column]
  32.     private ?bool $rnuit null;
  33.     #[ORM\ManyToOne]
  34.     private ?User $user null;
  35.     #[ORM\Column]
  36.     private ?int $retourVoiture null;
  37.     #[ORM\Column]
  38.     private ?int $interr null;
  39.     #[ORM\Column(typeTypes::TIME_MUTABLE)]
  40.     private ?\DateTimeInterface $amp null;
  41.     #[ORM\Column(typeTypes::TIME_MUTABLE)]
  42.     private ?\DateTimeInterface $serv null;
  43.     #[ORM\Column(typeTypes::TIME_MUTABLE)]
  44.     private ?\DateTimeInterface $cond null;
  45.     #[ORM\Column(typeTypes::TIME_MUTABLE)]
  46.     private ?\DateTimeInterface $trav null;
  47.     #[ORM\Column(typeTypes::TIME_MUTABLE)]
  48.     private ?\DateTimeInterface $coup null;
  49.     #[ORM\Column(typeTypes::TIME_MUTABLE)]
  50.     private ?\DateTimeInterface $heureNuit null;
  51.     #[ORM\Column]
  52.     private ?int $i null;
  53.     #[ORM\Column(typeTypes::TIME_MUTABLE)]
  54.     private ?\DateTimeInterface $av null;
  55.     #[ORM\Column(typeTypes::DATE_MUTABLE)]
  56.     private ?\DateTimeInterface $created null;
  57.     #[ORM\Column(typeTypes::TIME_MUTABLEnullabletrue)]
  58.     private ?\DateTimeInterface $heureVoitureAvant null;
  59.     #[ORM\Column(typeTypes::TIME_MUTABLEnullabletrue)]
  60.     private ?\DateTimeInterface $heureVoitureApres null;
  61.     /**
  62.      * DeclarationChauffeur constructor.
  63.      */
  64.     public function __construct($date,$user)
  65.     {
  66.         $this->date $date;
  67.         $this->user $user;
  68.     }
  69.     public function getId(): ?int
  70.     {
  71.         return $this->id;
  72.     }
  73.     public function getDate(): ?\DateTimeInterface
  74.     {
  75.         return $this->date;
  76.     }
  77.     public function setDate(\DateTimeInterface $date): self
  78.     {
  79.         $this->date $date;
  80.         return $this;
  81.     }
  82.     public function getHeureDepartDate(): ?\DateTimeInterface
  83.     {
  84.         $dateHeure = new \DateTime($this->date->format('Y-m-d').' '.$this->heureDepart->format('H:i:s'));
  85.         return $dateHeure;
  86.     }
  87.     public function getHeureDepart(): ?\DateTimeInterface
  88.     {
  89.         return $this->heureDepart;
  90.     }
  91.     public function setHeureDepart(\DateTimeInterface $heureDepart): self
  92.     {
  93.         $this->heureDepart $heureDepart;
  94.         return $this;
  95.     }
  96.     public function getHeureArriveeDate(): ?\DateTimeInterface
  97.     {
  98. /*var_dump($this->heureDepart);
  99. var_dump($this->heureArrivee);*/
  100.         if($this->heureDepart->format('H') < $this->heureArrivee->format('H'))
  101.         {
  102.             $dateHeure = new \DateTime($this->date->format('Y-m-d').' '.$this->heureArrivee->format('H:i:s'));
  103.         }
  104.         else
  105.         {/*echo 'ok';
  106.         var_dump($this->getId());
  107.         var_dump($this->date);*/
  108.             $date = clone $this->date;
  109.             $date $date->modify('+1 days');
  110.             //var_dump($date);
  111.             $dateHeure = new \DateTime($date->format('Y-m-d').' '.$this->heureArrivee->format('H:i:s'));
  112.         }
  113.         return $dateHeure;
  114.     }
  115.     public function getHeureArrivee(): ?\DateTimeInterface
  116.     {
  117.         return $this->heureArrivee;
  118.     }
  119.     public function setHeureArrivee(\DateTimeInterface $heureArrivee): self
  120.     {
  121.         $this->heureArrivee $heureArrivee;
  122.         return $this;
  123.     }
  124.     public function getVilleDepart(): ?VilleFrance
  125.     {
  126.         return $this->villeDepart;
  127.     }
  128.     public function setVilleDepart(VilleFrance $villeDepart): self
  129.     {
  130.         $this->villeDepart $villeDepart;
  131.         return $this;
  132.     }
  133.     public function getVilleArrivee(): ?VilleFrance
  134.     {
  135.         return $this->villeArrivee;
  136.     }
  137.     public function setVilleArrivee(VilleFrance $villeArrivee): self
  138.     {
  139.         $this->villeArrivee $villeArrivee;
  140.         return $this;
  141.     }
  142.     public function getPdj(): ?bool
  143.     {
  144.         return $this->pdj;
  145.     }
  146.     public function setPdj(bool $pdj): self
  147.     {
  148.         $this->pdj $pdj;
  149.         return $this;
  150.     }
  151.     public function getRmidi(): ?bool
  152.     {
  153.         return $this->rmidi;
  154.     }
  155.     public function setRmidi(bool $rmidi): self
  156.     {
  157.         $this->rmidi $rmidi;
  158.         return $this;
  159.     }
  160.     public function getRgd(): ?bool
  161.     {
  162.         return $this->rgd;
  163.     }
  164.     public function setRgd(bool $rgd): self
  165.     {
  166.         $this->rgd $rgd;
  167.         return $this;
  168.     }
  169.     public function getRnuit(): ?bool
  170.     {
  171.         return $this->rnuit;
  172.     }
  173.     public function setRnuit(bool $rnuit): self
  174.     {
  175.         $this->rnuit $rnuit;
  176.         return $this;
  177.     }
  178.     public function getRsoir(): ?bool
  179.     {
  180.         return $this->rsoir;
  181.     }
  182.     public function setRsoir(bool $rsoir): self
  183.     {
  184.         $this->rsoir $rsoir;
  185.         return $this;
  186.     }
  187.     public function getUser(): ?User
  188.     {
  189.         return $this->user;
  190.     }
  191.     public function setUser(User $user): self
  192.     {
  193.         $this->user $user;
  194.         return $this;
  195.     }
  196.     public function getRetourVoiture(): ?int
  197.     {
  198.         return $this->retourVoiture;
  199.     }
  200.     public function setRetourVoiture(int $retourVoiture): self
  201.     {
  202.         $this->retourVoiture $retourVoiture;
  203.         return $this;
  204.     }
  205.     public function getInterr(): ?int
  206.     {
  207.         return $this->interr;
  208.     }
  209.     public function setInterr(int $interr): static
  210.     {
  211.         $this->interr $interr;
  212.         return $this;
  213.     }
  214.     public function getAmp(): ?\DateTimeInterface
  215.     {
  216.         if ($this->amp === null) {
  217.             return new \DateTime('00:00:00');
  218.         }
  219.         return $this->amp;
  220.     }
  221.     public function setAmp(\DateTimeInterface $amp): static
  222.     {
  223.         $this->amp $amp;
  224.         return $this;
  225.     }
  226.     public function getServ(): ?\DateTimeInterface
  227.     {
  228.         if ($this->serv === null) {
  229.             return new \DateTime('00:00:00');
  230.         }
  231.         return $this->serv;
  232.     }
  233.     public function setServ(\DateTimeInterface $serv): static
  234.     {
  235.         $this->serv $serv;
  236.         return $this;
  237.     }
  238.     public function getCond(): ?\DateTimeInterface
  239.     {
  240.         if ($this->cond === null) {
  241.             return new \DateTime('00:00:00');
  242.         }
  243.         return $this->cond;
  244.     }
  245.     public function setCond(\DateTimeInterface $cond): static
  246.     {
  247.         $this->cond $cond;
  248.         return $this;
  249.     }
  250.     public function getTrav(): ?\DateTimeInterface
  251.     {
  252.         if ($this->trav === null) {
  253.             return new \DateTime('00:00:00');
  254.         }
  255.         return $this->trav;
  256.     }
  257.     public function setTrav(\DateTimeInterface $trav): static
  258.     {
  259.         $this->trav $trav;
  260.         return $this;
  261.     }
  262.     public function getCoup(): ?\DateTimeInterface
  263.     {
  264.         if ($this->coup === null) {
  265.             return new \DateTime('00:00:00');
  266.         }
  267.         return $this->coup;
  268.     }
  269.     public function setCoup(\DateTimeInterface $coup): static
  270.     {
  271.         $this->coup $coup;
  272.         return $this;
  273.     }
  274.     public function getHeureNuit(): ?\DateTimeInterface
  275.     {
  276.         if ($this->heureNuit === null) {
  277.             return new \DateTime('00:00:00');
  278.         }
  279.         return $this->heureNuit;
  280.     }
  281.     public function setHeureNuit(\DateTimeInterface $heureNuit): static
  282.     {
  283.         $this->heureNuit $heureNuit;
  284.         return $this;
  285.     }
  286.     public function getI(): ?int
  287.     {
  288.         return $this->i;
  289.     }
  290.     public function setI(int $i): static
  291.     {
  292.         $this->$i;
  293.         return $this;
  294.     }
  295.     public function getAv(): ?\DateTimeInterface
  296.     {
  297.         if ($this->av === null) {
  298.             return new \DateTime('00:00:00');
  299.         }
  300.         return $this->av;
  301.     }
  302.     public function setAv(\DateTimeInterface $av): static
  303.     {
  304.         $this->av $av;
  305.         return $this;
  306.     }
  307.     public function getCreated(): ?\DateTimeInterface
  308.     {
  309.         return $this->created;
  310.     }
  311.     public function setCreated(\DateTimeInterface $created): static
  312.     {
  313.         $this->created $created;
  314.         return $this;
  315.     }
  316.     public function getHeureVoitureAvant(): ?\DateTimeInterface
  317.     {
  318.         return $this->heureVoitureAvant;
  319.     }
  320.     public function setHeureVoitureAvant(?\DateTimeInterface $heureVoitureAvant): static
  321.     {
  322.         $this->heureVoitureAvant $heureVoitureAvant;
  323.         return $this;
  324.     }
  325.     public function getHeureVoitureApres(): ?\DateTimeInterface
  326.     {
  327.         return $this->heureVoitureApres;
  328.     }
  329.     public function setHeureVoitureApres(?\DateTimeInterface $heureVoitureApres): static
  330.     {
  331.         $this->heureVoitureApres $heureVoitureApres;
  332.         return $this;
  333.     }
  334. }