src/Entity/Events.php line 17
<?phpnamespace App\Entity;use App\Repository\EventsRepository;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;use App\Entity\TaxonomyValue;use App\Enum\EventStatus;#[ORM\Entity(repositoryClass: EventsRepository::class)]#[UniqueEntity(fields: ['extCode'], message: 'Este código ya está en uso.')]class Events{#[ORM\Id]#[ORM\GeneratedValue]#[ORM\Column]private ?int $id = null;#[ORM\Column(length: 255)]private ?string $Name = null;#[ORM\Column(length: 255)]private ?string $extCode = null;#[ORM\Column(type: 'boolean')]private bool $published = true;#[ORM\Column(type: Types::DATE_MUTABLE)]private ?\DateTimeInterface $startDate = null;#[ORM\Column(type: Types::DATE_MUTABLE)]private ?\DateTimeInterface $endDate = null;#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]private ?\DateTimeInterface $inscripcionesInicio = null;#[ORM\Column(type: Types::DATE_MUTABLE, nullable: true)]private ?\DateTimeInterface $inscripcionesFin = null;#[ORM\Column(type: Types::TIME_MUTABLE, nullable: true)]private ?\DateTimeInterface $startTime = null;#[ORM\Column(type: Types::TIME_MUTABLE, nullable: true)]private ?\DateTimeInterface $endTime = null;#[ORM\Column(nullable: true)]private ?int $maxRegistrations = null;#[ORM\OneToMany(mappedBy: 'eventId', targetEntity: Registrations::class, orphanRemoval: true)]private Collection $registrations;#[ORM\Column(type: Types::DATETIME_MUTABLE)]private ?\DateTimeInterface $created = null;#[ORM\Column(type: Types::DATETIME_MUTABLE)]private ?\DateTimeInterface $updated = null;#[ORM\Column(nullable: true)]private ?bool $generationQr = null;/*** @ORM\ManyToOne(targetEntity="App\Entity\Centers")* @ORM\JoinColumn(name="id", referencedColumnName="id")*/private $center_id;#[ORM\ManyToOne(inversedBy: 'events')]#[ORM\JoinColumn(nullable: true)]private ?Centers $center = null;#[ORM\ManyToMany(targetEntity: User::class, inversedBy: 'events')]private Collection $courseUser;#[ORM\Column(enumType: EventStatus::class)]private EventStatus $status;#[ORM\ManyToMany(targetEntity: User::class, inversedBy: 'managedEvents')]#[ORM\JoinTable(name: 'events_manager_user')]private Collection $managerUsers;#[ORM\Column(nullable: true)]private ?int $Hours = null;#[ORM\Column(nullable: true)]private ?int $Participants = null;#[ORM\Column(length: 255, nullable: true)]private ?string $TargetGroups = null;#[ORM\ManyToOne]#[ORM\JoinColumn(nullable: true)]private ?TaxonomyValue $modality = null;#[ORM\Column(length: 255, nullable: true)]private ?string $TargetAdmin = null;#[ORM\Column(nullable: true)]private ?int $totalDays = null;#[ORM\Column(nullable: true)]private ?int $shift = null;#[ORM\Column(nullable: true)]private ?int $numberCheckings = null;#[ORM\Column(nullable: true)]private ?float $minCompliance = null;#[ORM\Column(length: 255, nullable: true)]private ?string $image = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $description = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $objetives = null;#[ORM\ManyToMany(targetEntity: TaxonomyValue::class, inversedBy: 'events')]private Collection $areaTematica;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $skills = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $contents = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $plannedMaterials = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $internalObservations = null;#[ORM\Column(type: Types::BOOLEAN, options: ['default' => true])]private bool $controlAsistencias = true;#[ORM\Column(type: Types::BOOLEAN, options: ['default' => false])]private bool $cuestionarioConocimiento = false;#[ORM\Column(type: Types::BOOLEAN, options: ['default' => false])]private bool $actividadesPracticas = false;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $evaluacionCertificacionInterna = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $Prerequisites = null;#[ORM\Column(type: Types::TEXT, nullable: true)]private ?string $TechnicalRequirements = null;#[ORM\Column(length: 255, nullable: true)]private ?string $DateAndTime = null;#[ORM\Column(type: 'string', length: 255, nullable: true)]private ?string $Location = null;#[ORM\OneToMany(mappedBy: 'event', targetEntity: EventRequest::class, orphanRemoval: true)]private Collection $eventRequests;#[ORM\OneToMany(mappedBy: 'event', targetEntity: RegistrationQualification::class, orphanRemoval: true)]private Collection $registrationQualifications;public function __construct(){$this->status = EventStatus::ABIERTO;$this->registrations = new ArrayCollection();$this->courseUser = new ArrayCollection();$this->managerUsers = new ArrayCollection();$this->areaTematica = new ArrayCollection();$this->eventRequests = new ArrayCollection();$this->registrationQualifications = new ArrayCollection();}public function __toString(): string{return "$this->Name ($this->id)";}public function getId(): ?int{return $this->id;}public function getName(): ?string{return $this->Name;}public function setName(string $Name): static{$this->Name = $Name;return $this;}public function getExtCode(): ?string{return $this->extCode;}public function setExtCode(string $extCode): static{$this->extCode = $extCode;return $this;}public function getStartDate(): ?\DateTimeInterface{return $this->startDate;}public function setStartDate(\DateTimeInterface $startDate): static{$this->startDate = $startDate;return $this;}public function getEndDate(): ?\DateTimeInterface{return $this->endDate;}public function setEndDate(\DateTimeInterface $endDate): static{$this->endDate = $endDate;return $this;}public function getStartTime(): ?\DateTimeInterface{return $this->startTime;}public function setStartTime(\DateTimeInterface $startTime): static{$this->startTime = $startTime;return $this;}public function getEndTime(): ?\DateTimeInterface{return $this->endTime;}public function setEndTime(\DateTimeInterface $endTime): static{$this->endTime = $endTime;return $this;}public function getMaxRegistrations(): ?int{return $this->maxRegistrations;}public function setMaxRegistrations(?int $maxRegistrations): static{$this->maxRegistrations = $maxRegistrations;return $this;}/*** @return Collection<int, Registrations>*/public function getRegistrations(): Collection{return $this->registrations;}/*** @return Collection<int, Registrations>*/public function getActiveRegistrations(): Collection{return $this->registrations->filter(static function (Registrations $registration): bool {return (bool) $registration->isActive();});}public function addRegistration(Registrations $registration): static{if (!$this->registrations->contains($registration)) {$this->registrations->add($registration);$registration->setEventId($this);}return $this;}public function removeRegistration(Registrations $registration): static{if ($this->registrations->removeElement($registration)) {// set the owning side to null (unless already changed)if ($registration->getEventId() === $this) {$registration->setEventId(null);}}return $this;}public function getCreated(): ?\DateTimeInterface{return $this->created;}public function setCreated(\DateTimeInterface $created): static{$this->created = $created;return $this;}public function getUpdated(): ?\DateTimeInterface{return $this->updated;}public function setUpdated(\DateTimeInterface $updated): static{$this->updated = $updated;return $this;}public function isGenerationQr(): ?bool{return $this->generationQr;}public function setGenerationQr(bool $generationQr): static{$this->generationQr = $generationQr;return $this;}public function getCenter(): ?Centers{return $this->center;}public function setCenter(?Centers $center): static{$this->center = $center;return $this;}/*** @return Collection<int, User>*/public function getCourseUser(): Collection{return $this->courseUser;}public function addCourseUser(User $courseUser): static{if (!$this->courseUser->contains($courseUser)) {$this->courseUser->add($courseUser);}return $this;}public function removeCourseUser(User $courseUser): static{$this->courseUser->removeElement($courseUser);return $this;}public function getStatus(): EventStatus{return $this->status;}public function setStatus(EventStatus $status): self{$this->status = $status;return $this;}/*** @return Collection<int, User>*/public function getManagerUsers(): Collection{return $this->managerUsers;}public function addManagerUser(User $managerUser): static{if (!$this->managerUsers->contains($managerUser)) {$this->managerUsers->add($managerUser);if (!$managerUser->getManagedEvents()->contains($this)) {$managerUser->getManagedEvents()->add($this);}}return $this;}public function removeManagerUser(User $managerUser): static{if ($this->managerUsers->removeElement($managerUser)) {$managerUser->getManagedEvents()->removeElement($this);}return $this;}public function getHours(): ?int{return $this->Hours;}public function setHours(?int $Hours): static{$this->Hours = $Hours;return $this;}public function getParticipants(): ?int{return $this->Participants;}public function setParticipants(?int $Participants): static{$this->Participants = $Participants;return $this;}public function getTargetGroups(): ?string{return $this->TargetGroups;}public function setTargetGroups(?string $TargetGroups): static{$this->TargetGroups = $TargetGroups;return $this;}public function getModality(): ?TaxonomyValue{return $this->modality;}public function setModality(?TaxonomyValue $modality): self{$this->modality = $modality;return $this;}public function getTargetAdmin(): ?string{return $this->TargetAdmin;}public function setTargetAdmin(?string $TargetAdmin): static{$this->TargetAdmin = $TargetAdmin;return $this;}public function getTotalDays(): ?int{return $this->totalDays;}public function setTotalDays(?int $totalDays): static{$this->totalDays = $totalDays;return $this;}public function getShift(): ?int{return $this->shift;}public function setShift(int $shift): static{$this->shift = $shift;return $this;}public function getNumberCheckings(): ?int{return $this->numberCheckings;}public function setNumberCheckings(?int $numberCheckings): static{$this->numberCheckings = $numberCheckings;return $this;}public function getMinCompliance(): ?float{return $this->minCompliance;}public function setMinCompliance(?float $minCompliance): static{$this->minCompliance = $minCompliance;return $this;}public function getImage(): ?string{return $this->image;}public function setImage(?string $image): self{$this->image = $image;return $this;}public function getDescription(): ?string{return $this->description;}public function setDescription(?string $description): static{$this->description = $description;return $this;}public function getObjetives(): ?string{return $this->objetives;}public function setObjetives(?string $objetives): static{$this->objetives = $objetives;return $this;}/*** @return Collection<int, TaxonomyValue>*/public function getAreaTematica(): Collection{return $this->areaTematica;}public function addAreaTematica(TaxonomyValue $areaTematica): static{if (!$this->areaTematica->contains($areaTematica)) {$this->areaTematica->add($areaTematica);}return $this;}public function setAreaTematica(Collection $areaTematica): self{$this->areaTematica = $areaTematica;return $this;}public function removeAreaTematica(TaxonomyValue $areaTematica): static{$this->areaTematica->removeElement($areaTematica);return $this;}public function getSkills(): ?string{return $this->skills;}public function setSkills(?string $skills): static{$this->skills = $skills;return $this;}public function getContents(): ?string{return $this->contents;}public function setContents(?string $contents): static{$this->contents = $contents;return $this;}public function getPlannedMaterials(): ?string{return $this->plannedMaterials;}public function setPlannedMaterials(?string $plannedMaterials): static{$this->plannedMaterials = $plannedMaterials;return $this;}public function getInternalObservations(): ?string{return $this->internalObservations;}public function setInternalObservations(?string $internalObservations): static{$this->internalObservations = $internalObservations;return $this;}public function isControlAsistencias(): bool{return $this->controlAsistencias;}public function setControlAsistencias(bool $controlAsistencias): static{$this->controlAsistencias = $controlAsistencias;return $this;}public function isCuestionarioConocimiento(): bool{return $this->cuestionarioConocimiento;}public function setCuestionarioConocimiento(bool $cuestionarioConocimiento): static{$this->cuestionarioConocimiento = $cuestionarioConocimiento;return $this;}public function isActividadesPracticas(): bool{return $this->actividadesPracticas;}public function setActividadesPracticas(bool $actividadesPracticas): static{$this->actividadesPracticas = $actividadesPracticas;return $this;}public function getEvaluacionCertificacionInterna(): ?string{return $this->evaluacionCertificacionInterna;}public function setEvaluacionCertificacionInterna(?string $evaluacionCertificacionInterna): static{$this->evaluacionCertificacionInterna = $evaluacionCertificacionInterna;return $this;}public function getPrerequisites(): ?string{return $this->Prerequisites;}public function setPrerequisites(?string $Prerequisites): static{$this->Prerequisites = $Prerequisites;return $this;}public function getTechnicalRequirements(): ?string{return $this->TechnicalRequirements;}public function setTechnicalRequirements(?string $TechnicalRequirements): static{$this->TechnicalRequirements = $TechnicalRequirements;return $this;}public function getDateAndTime(): ?string{return $this->DateAndTime;}public function setDateAndTime(?string $DateAndTime): static{$this->DateAndTime = $DateAndTime;return $this;}public function getLocation(): ?string{return $this->Location;}public function setLocation(?string $Location): static{$this->Location = $Location;return $this;}/*** @return Collection<int, EventRequest>*/public function getEventRequests(): Collection{return $this->eventRequests;}public function addEventRequest(EventRequest $eventRequest): static{if (!$this->eventRequests->contains($eventRequest)) {$this->eventRequests->add($eventRequest);$eventRequest->setEvent($this);}return $this;}public function removeEventRequest(EventRequest $eventRequest): static{if ($this->eventRequests->removeElement($eventRequest)) {// set the owning side to null (unless already changed)if ($eventRequest->getEvent() === $this) {$eventRequest->setEvent(null);}}return $this;}/*** @return Collection<int, RegistrationQualification>*/public function getRegistrationQualifications(): Collection{return $this->registrationQualifications;}public function addRegistrationQualification(RegistrationQualification $registrationQualification): static{if (!$this->registrationQualifications->contains($registrationQualification)) {$this->registrationQualifications->add($registrationQualification);$registrationQualification->setEvent($this);}return $this;}public function removeRegistrationQualification(RegistrationQualification $registrationQualification): static{if ($this->registrationQualifications->removeElement($registrationQualification)) {if ($registrationQualification->getEvent() === $this) {$registrationQualification->setEvent(null);}}return $this;}public function getInscripcionesInicio(): ?\DateTimeInterface{return $this->inscripcionesInicio;}public function setInscripcionesInicio(?\DateTimeInterface $fecha): self{$this->inscripcionesInicio = $fecha;return $this;}public function getInscripcionesFin(): ?\DateTimeInterface{return $this->inscripcionesFin;}public function setInscripcionesFin(?\DateTimeInterface $fecha): self{$this->inscripcionesFin = $fecha;return $this;}public function isPublished(): bool{return $this->published;}public function setPublished(bool $published): self{$this->published = $published;return $this;}public function isInscripcionAbierta(): bool{if (!$this->published || !$this->inscripcionesInicio || !$this->inscripcionesFin) {return false;}$today = new \DateTime('today');return $today >= $this->inscripcionesInicio && $today <= $this->inscripcionesFin;}//TODO: Borrar (Temporal)public function isActivo(): bool{return $this->status === EventStatus::ABIERTO;}}