src/Entity/TblOperationTravail.php line 16

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Entity\Traits\TimestampableTrait;
  4. use App\Repository\TblOperationTravailRepository;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. use Doctrine\ORM\Mapping as ORM;
  9. /**
  10.  * @ORM\Entity(repositoryClass=TblOperationTravailRepository::class)
  11.  * @Gedmo\Loggable
  12.  */
  13. class TblOperationTravail
  14. {
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\ManyToOne(targetEntity=RefDureeOperationTravail::class)
  23.      * @ORM\JoinColumn(nullable=false)
  24.      * @Gedmo\Versioned
  25.      */
  26.     private $dureeOperationTravail;
  27.     /**
  28.      * @ORM\ManyToOne(targetEntity=RefTypeOperationTravail::class)
  29.      * @ORM\JoinColumn(nullable=false)
  30.      * @Gedmo\Versioned
  31.      */
  32.     private $typeOperationTravail;
  33.     /**
  34.      * @ORM\ManyToMany(targetEntity=TblParcelle::class, inversedBy="tblOperationTravail"  ,cascade={"persist"})
  35.      * @ORM\JoinTable(name="lnk_operationTravail_parcelle",
  36.      *   joinColumns={
  37.      *     @ORM\JoinColumn(name="operationTravail_id", referencedColumnName="id")
  38.      *   },
  39.      *   inverseJoinColumns={
  40.      *     @ORM\JoinColumn(name="parcelle_id", referencedColumnName="id", nullable=false )
  41.      *   }
  42.      * )
  43.      */
  44.     private $parcelle;
  45.     /**
  46.      * @ORM\Column(type="time")
  47.      * @Gedmo\Versioned
  48.      */
  49.     private $heureDebut;
  50.     /**
  51.      * @ORM\Column(type="time")
  52.      * @Gedmo\Versioned
  53.      */
  54.     private $heureFin;
  55.     /**
  56.      * @ORM\Column(type="date")
  57.      * @Gedmo\Versioned
  58.      */
  59.     private $dateOperation;
  60.     /**
  61.      * @ORM\ManyToOne(targetEntity=TblPersonnel::class , inversedBy="tblOperationsTravail")
  62.      * @ORM\JoinColumn(nullable=false)
  63.      * @Gedmo\Versioned
  64.      */
  65.     private $personnel;
  66.     /**
  67.      * @ORM\Column(type="float")
  68.      * @Gedmo\Versioned
  69.      */
  70.     private $montantTJM;
  71.     public function __construct()
  72.     {
  73.         $this->parcelle = new ArrayCollection();
  74.     }
  75.     use TimestampableTrait;
  76.     
  77.     public function getId(): ?int
  78.     {
  79.         return $this->id;
  80.     }
  81.     public function getDureeOperationTravail(): ?RefDureeOperationTravail
  82.     {
  83.         return $this->dureeOperationTravail;
  84.     }
  85.     public function setDureeOperationTravail(?RefDureeOperationTravail $dureeOperationTravail): self
  86.     {
  87.         $this->dureeOperationTravail $dureeOperationTravail;
  88.         return $this;
  89.     }
  90.     public function getTypeOperationTravail(): ?RefTypeOperationTravail
  91.     {
  92.         return $this->typeOperationTravail;
  93.     }
  94.     public function setTypeOperationTravail(?RefTypeOperationTravail $typeOperationTravail): self
  95.     {
  96.         $this->typeOperationTravail $typeOperationTravail;
  97.         return $this;
  98.     }
  99.     public function getHeureDebut(): ?\DateTimeInterface
  100.     {
  101.         return $this->heureDebut;
  102.     }
  103.     public function setHeureDebut(?\DateTimeInterface $heureDebut): self
  104.     {
  105.         $this->heureDebut $heureDebut;
  106.         return $this;
  107.     }
  108.     public function getHeureFin(): ?\DateTimeInterface
  109.     {
  110.         return $this->heureFin;
  111.     }
  112.     public function setHeureFin(?\DateTimeInterface $heureFin): self
  113.     {
  114.         $this->heureFin $heureFin;
  115.         return $this;
  116.     }
  117.     public function getDateOperation(): ?\DateTimeInterface
  118.     {
  119.         return $this->dateOperation;
  120.     }
  121.     public function setDateOperation(?\DateTimeInterface $dateOperation): self
  122.     {
  123.         $this->dateOperation $dateOperation;
  124.         return $this;
  125.     }
  126.     public function getPersonnel(): ?TblPersonnel
  127.     {
  128.         return $this->personnel;
  129.     }
  130.     public function setPersonnel(?TblPersonnel $personnel): self
  131.     {
  132.         $this->personnel $personnel;
  133.         return $this;
  134.     }
  135.     public function getMontantTJM(): ?float
  136.     {
  137.         return $this->montantTJM;
  138.     }
  139.     public function setMontantTJM(float $montantTJM): self
  140.     {
  141.         $this->montantTJM $montantTJM;
  142.         return $this;
  143.     }
  144.     public function toArrayDatatable($urlEdit)
  145.     {
  146.         return [
  147.             $this->getPersonnel()->__toString(),
  148.             "<span class='badge badge-outline text-green'>".$this->getTypeOperationTravail()."</span>",
  149.             number_format($this->getMontantTJM()*$this->getDureeOperationTravail()->getValeurJour(), 2","" "),
  150.             $this->getDureeOperationTravail()->__toString(),
  151.             $this->getParcellestr(),
  152.             $this->getDateOperation()->format('Y-m-d'),
  153.             '<a class="btn btn-primary" title="Modifier" href=' $urlEdit '><i class="ti ti-edit"></i></a>',
  154.         ];
  155.     }
  156.     public function getParcellestr()
  157.     {
  158.         $result '';
  159.         
  160.         foreach($this->getParcelle() as $parcelle) {
  161.          $result .= $parcelle->getParcelle(). '<br>'
  162.         }
  163.         return $result;
  164.     }
  165.     /**
  166.      * @return Collection<int, TblParcelle>
  167.      */
  168.     public function getParcelle(): Collection
  169.     {
  170.         return $this->parcelle;
  171.     }
  172.     public function addParcelle(TblParcelle $parcelle): self
  173.     {
  174.         if (!$this->parcelle->contains($parcelle)) {
  175.             $this->parcelle[] = $parcelle;
  176.         }
  177.         return $this;
  178.     }
  179.     public function removeParcelle(TblParcelle $parcelle): self
  180.     {
  181.         $this->parcelle->removeElement($parcelle);
  182.         return $this;
  183.     }
  184. }