<?phpnamespace App\Entity\Mantenimiento\Preventivo;use App\Repository\Mantenimiento\Preventivo\TareaPlanRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Validator\Constraints as Assert;/** * @ORM\Entity(repositoryClass=TareaPlanRepository::class) * @ORM\Table(name="mant_prev_tareas_plan") */class TareaPlan{ /** * @ORM\Id * @ORM\GeneratedValue * @ORM\Column(type="integer") */ private $id; /** * @ORM\Column(type="string", length=255) * @Assert\NotNull(message="El campo tarea es requerido") */ private $tarea; /** * @ORM\Column(type="text", nullable=true) */ private $detalle; /** * @ORM\Column(type="boolean") */ private $activa = true; /** * @ORM\ManyToOne(targetEntity=PlanMantenimiento::class, inversedBy="tareas") * @ORM\JoinColumn(name="id_plan", referencedColumnName="id") * @Assert\NotNull(message="El campo es requerido") */ private $planMantenimiento; /** * @ORM\OneToMany(targetEntity=ConsumoTarea::class, mappedBy="tareaPlan", cascade={"persist", "remove"}) */ private $consumos; public function __construct() { $this->consumos = new ArrayCollection(); } public function getId(): ?int { return $this->id; } public function getDetalle(): ?string { return $this->detalle; } public function setDetalle(string $detalle): self { $this->detalle = $detalle; return $this; } public function isActiva(): ?bool { return $this->activa; } public function setActiva(bool $activa): self { $this->activa = $activa; return $this; } public function getPlanMantenimiento(): ?PlanMantenimiento { return $this->planMantenimiento; } public function setPlanMantenimiento(?PlanMantenimiento $planMantenimiento): self { $this->planMantenimiento = $planMantenimiento; return $this; } public function getTarea(): ?string { return $this->tarea; } public function setTarea(string $tarea): self { $this->tarea = $tarea; return $this; } /** * @return Collection<int, ConsumoTarea> */ public function getConsumos(): Collection { return $this->consumos; } public function addConsumo(ConsumoTarea $consumo): self { if (!$this->consumos->contains($consumo)) { $this->consumos[] = $consumo; $consumo->setTareaPlan($this); } return $this; } public function removeConsumo(ConsumoTarea $consumo): self { if ($this->consumos->removeElement($consumo)) { // set the owning side to null (unless already changed) if ($consumo->getTareaPlan() === $this) { $consumo->setTareaPlan(null); } } return $this; }}