src/Entity/Proyecto.php line 11

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ProyectoRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. #[ORM\Entity(repositoryClassProyectoRepository::class)]
  8. class Proyecto
  9. {
  10.     #[ORM\Id]
  11.     #[ORM\GeneratedValue]
  12.     #[ORM\Column]
  13.     private ?int $id null;
  14.     // === DATOS BÁSICOS ===
  15.     #[ORM\Column(length255)]
  16.     private ?string $nombre null;
  17.     #[ORM\Column(length255nullabletrue)]
  18.     private ?string $descripcion null;
  19.     #[ORM\Column(length255nullabletrue)]
  20.     private ?string $ubicacion null;
  21.     #[ORM\Column(length255nullabletrue)]
  22.     private ?string $estado null;
  23.     // === FECHAS ===
  24.     #[ORM\Column(type'datetime'options: ['default' => 'CURRENT_TIMESTAMP'])]
  25.     private ?\DateTimeInterface $fechaCreacion null;
  26.     #[ORM\Column(type'date'nullabletrue)]
  27.     private ?\DateTimeInterface $fechaInicio null;
  28.     #[ORM\Column(type'date'nullabletrue)]
  29.     private ?\DateTimeInterface $fechaTermino null;
  30.     // === RELACIONES ===
  31.     #[ORM\ManyToOne(targetEntityMandante::class)]
  32.     #[ORM\JoinColumn(nullabletrueonDelete'SET NULL')]
  33.     private ?Mandante $mandante null;
  34.     #[ORM\ManyToOne(targetEntitySuperMandante::class)]
  35.     #[ORM\JoinColumn(nullabletrueonDelete'SET NULL')]
  36.     private ?SuperMandante $superMandante null;
  37.     #[ORM\ManyToMany(targetEntityCamara::class)]
  38.     #[ORM\JoinTable(name'proyecto_camaras')]
  39.     private Collection $camaras;
  40.     #[ORM\Column(options: ['default' => true])]
  41.     private ?bool $activo true;
  42.     public function __construct()
  43.     {
  44.         $this->camaras = new ArrayCollection();
  45.         $this->fechaCreacion = new \DateTime(); // se setea automáticamente al crear
  46.     }
  47.     // === GETTERS & SETTERS ===
  48.     public function getId(): ?int
  49.     {
  50.         return $this->id;
  51.     }
  52.     public function getNombre(): ?string
  53.     {
  54.         return $this->nombre;
  55.     }
  56.     public function setNombre(string $nombre): static
  57.     {
  58.         $this->nombre $nombre;
  59.         return $this;
  60.     }
  61.     public function getDescripcion(): ?string
  62.     {
  63.         return $this->descripcion;
  64.     }
  65.     public function setDescripcion(?string $descripcion): static
  66.     {
  67.         $this->descripcion $descripcion;
  68.         return $this;
  69.     }
  70.     public function getUbicacion(): ?string
  71.     {
  72.         return $this->ubicacion;
  73.     }
  74.     public function setUbicacion(?string $ubicacion): static
  75.     {
  76.         $this->ubicacion $ubicacion;
  77.         return $this;
  78.     }
  79.     public function getEstado(): ?string
  80.     {
  81.         return $this->estado;
  82.     }
  83.     public function setEstado(?string $estado): static
  84.     {
  85.         $this->estado $estado;
  86.         return $this;
  87.     }
  88.     public function getFechaCreacion(): ?\DateTimeInterface
  89.     {
  90.         return $this->fechaCreacion;
  91.     }
  92.     public function setFechaCreacion(\DateTimeInterface $fechaCreacion): static
  93.     {
  94.         $this->fechaCreacion $fechaCreacion;
  95.         return $this;
  96.     }
  97.     public function getFechaInicio(): ?\DateTimeInterface
  98.     {
  99.         return $this->fechaInicio;
  100.     }
  101.     public function setFechaInicio(?\DateTimeInterface $fechaInicio): static
  102.     {
  103.         $this->fechaInicio $fechaInicio;
  104.         return $this;
  105.     }
  106.     public function getFechaTermino(): ?\DateTimeInterface
  107.     {
  108.         return $this->fechaTermino;
  109.     }
  110.     public function setFechaTermino(?\DateTimeInterface $fechaTermino): static
  111.     {
  112.         $this->fechaTermino $fechaTermino;
  113.         return $this;
  114.     }
  115.     public function getMandante(): ?Mandante
  116.     {
  117.         return $this->mandante;
  118.     }
  119.     public function setMandante(?Mandante $mandante): static
  120.     {
  121.         $this->mandante $mandante;
  122.         return $this;
  123.     }
  124.     public function getSuperMandante(): ?SuperMandante
  125.     {
  126.         return $this->superMandante;
  127.     }
  128.     public function setSuperMandante(?SuperMandante $superMandante): static
  129.     {
  130.         $this->superMandante $superMandante;
  131.         return $this;
  132.     }
  133.     /**
  134.      * @return Collection<int, Camara>
  135.      */
  136.     public function getCamaras(): Collection
  137.     {
  138.         return $this->camaras;
  139.     }
  140.     public function addCamara(Camara $camara): static
  141.     {
  142.         if (!$this->camaras->contains($camara)) {
  143.             $this->camaras->add($camara);
  144.         }
  145.         return $this;
  146.     }
  147.     public function removeCamara(Camara $camara): static
  148.     {
  149.         $this->camaras->removeElement($camara);
  150.         return $this;
  151.     }
  152.     public function isActivo(): ?bool
  153.     {
  154.         return $this->activo;
  155.     }
  156.     public function setActivo(bool $activo): static
  157.     {
  158.         $this->activo $activo;
  159.         return $this;
  160.     }
  161. }