src/Entity/Mantenimiento/Preventivo/TareaPlan.php line 17

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Mantenimiento\Preventivo;
  3. use App\Repository\Mantenimiento\Preventivo\TareaPlanRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. /**
  10.  * @ORM\Entity(repositoryClass=TareaPlanRepository::class)
  11.  * @ORM\Table(name="mant_prev_tareas_plan")
  12.  */
  13. class TareaPlan
  14. {
  15.     /**
  16.      * @ORM\Id
  17.      * @ORM\GeneratedValue
  18.      * @ORM\Column(type="integer")
  19.      */
  20.     private $id;
  21.     /**
  22.      * @ORM\Column(type="string", length=255)
  23.      * @Assert\NotNull(message="El campo tarea es requerido")
  24.      */
  25.     private $tarea;
  26.     /**
  27.      * @ORM\Column(type="text", nullable=true)
  28.      */
  29.     private $detalle;
  30.     /**
  31.      * @ORM\Column(type="boolean")
  32.      */
  33.     private $activa true;
  34.     /**
  35.      * @ORM\ManyToOne(targetEntity=PlanMantenimiento::class, inversedBy="tareas")
  36.      * @ORM\JoinColumn(name="id_plan", referencedColumnName="id")
  37.      * @Assert\NotNull(message="El campo es requerido")
  38.      */
  39.     private $planMantenimiento;
  40.     /**
  41.      * @ORM\OneToMany(targetEntity=ConsumoTarea::class, mappedBy="tareaPlan", cascade={"persist", "remove"})
  42.      */
  43.     private $consumos;
  44.     public function __construct()
  45.     {
  46.         $this->consumos = new ArrayCollection();
  47.     }
  48.     
  49.     public function getId(): ?int
  50.     {
  51.         return $this->id;
  52.     }
  53.     public function getDetalle(): ?string
  54.     {
  55.         return $this->detalle;
  56.     }
  57.     public function setDetalle(string $detalle): self
  58.     {
  59.         $this->detalle $detalle;
  60.         return $this;
  61.     }
  62.     public function isActiva(): ?bool
  63.     {
  64.         return $this->activa;
  65.     }
  66.     public function setActiva(bool $activa): self
  67.     {
  68.         $this->activa $activa;
  69.         return $this;
  70.     }
  71.     public function getPlanMantenimiento(): ?PlanMantenimiento
  72.     {
  73.         return $this->planMantenimiento;
  74.     }
  75.     public function setPlanMantenimiento(?PlanMantenimiento $planMantenimiento): self
  76.     {
  77.         $this->planMantenimiento $planMantenimiento;
  78.         return $this;
  79.     }
  80.     public function getTarea(): ?string
  81.     {
  82.         return $this->tarea;
  83.     }
  84.     public function setTarea(string $tarea): self
  85.     {
  86.         $this->tarea $tarea;
  87.         return $this;
  88.     }
  89.     /**
  90.      * @return Collection<int, ConsumoTarea>
  91.      */
  92.     public function getConsumos(): Collection
  93.     {
  94.         return $this->consumos;
  95.     }
  96.     public function addConsumo(ConsumoTarea $consumo): self
  97.     {
  98.         if (!$this->consumos->contains($consumo)) {
  99.             $this->consumos[] = $consumo;
  100.             $consumo->setTareaPlan($this);
  101.         }
  102.         return $this;
  103.     }
  104.     public function removeConsumo(ConsumoTarea $consumo): self
  105.     {
  106.         if ($this->consumos->removeElement($consumo)) {
  107.             // set the owning side to null (unless already changed)
  108.             if ($consumo->getTareaPlan() === $this) {
  109.                 $consumo->setTareaPlan(null);
  110.             }
  111.         }
  112.         return $this;
  113.     }
  114. }