src/Entity/Comun/Fichaje.php line 10

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Comun;
  3. use App\Entity\Admin\Empleada;
  4. use App\Repository\Comun\FichajeRepository;
  5. use Doctrine\ORM\Mapping as ORM;
  6. #[ORM\Entity(repositoryClassFichajeRepository::class)]
  7. class Fichaje
  8. {
  9.     #[ORM\Id]
  10.     #[ORM\GeneratedValue]
  11.     #[ORM\Column(type'integer')]
  12.     private $id;
  13.     #[ORM\Column(type'float')]
  14.     private $cantidadHoras;
  15.     #[ORM\Column(type'string'length600nullabletrue)]
  16.     private $observaciones;
  17.     #[ORM\ManyToOne(targetEntityProyecto::class, inversedBy'fichajes')]
  18.     private $proyecto;
  19.     #[ORM\ManyToOne(targetEntityTarea::class, inversedBy'fichajes')]
  20.     private $tarea;
  21.     #[ORM\Column(type'date')]
  22.     private $fecha;
  23.     #[ORM\ManyToOne(targetEntityEmpleada::class, inversedBy'fichajes')]
  24.     #[ORM\JoinColumn(nullablefalse)]
  25.     private $empleada;
  26.     public function getId(): ?int
  27.     {
  28.         return $this->id;
  29.     }
  30.     public function getCantidadHoras(): ?float
  31.     {
  32.         return $this->cantidadHoras;
  33.     }
  34.     public function setCantidadHoras(float $cantidadHoras): self
  35.     {
  36.         $this->cantidadHoras $cantidadHoras;
  37.         return $this;
  38.     }
  39.     public function getObservaciones(): ?string
  40.     {
  41.         return $this->observaciones;
  42.     }
  43.     public function setObservaciones(?string $observaciones): self
  44.     {
  45.         $this->observaciones $observaciones;
  46.         return $this;
  47.     }
  48.     public function getProyecto(): ?Proyecto
  49.     {
  50.         return $this->proyecto;
  51.     }
  52.     public function setProyecto(?Proyecto $proyecto): self
  53.     {
  54.         $this->proyecto $proyecto;
  55.         return $this;
  56.     }
  57.     public function getTarea(): ?Tarea
  58.     {
  59.         return $this->tarea;
  60.     }
  61.     public function setTarea(?Tarea $tarea): self
  62.     {
  63.         $this->tarea $tarea;
  64.         return $this;
  65.     }
  66.     public function getFecha(): ?\DateTimeInterface
  67.     {
  68.         return $this->fecha;
  69.     }
  70.     public function setFecha(\DateTimeInterface $fecha): self
  71.     {
  72.         $this->fecha $fecha;
  73.         return $this;
  74.     }
  75.     public function getEmpleada(): ?Empleada
  76.     {
  77.         return $this->empleada;
  78.     }
  79.     public function setEmpleada(?Empleada $empleada): self
  80.     {
  81.         $this->empleada $empleada;
  82.         return $this;
  83.     }
  84.     
  85.     public function getCantidadHorasFormat(){
  86.         
  87.        $minutosTotales$this->cantidadHoras*60;
  88.        $horasTotales=0;
  89.        
  90.         while ($minutosTotales >= 60) {
  91.             $minutosTotales $minutosTotales 60;
  92.             $horasTotales $horasTotales 1;
  93.         }
  94.         return $horasTotales "h " intval($minutosTotales) . "m";
  95.                
  96.     }
  97.         
  98.     
  99.     
  100. }