src/Entity/Modalidad.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. /**
  9. * @ORM\Entity
  10. * @ORM\Table(name="modalidad")
  11. */
  12. class Modalidad extends \App\Entity\BaseEntity
  13. {
  14. /**
  15. * @ORM\Id
  16. * @ORM\Column(type="integer")
  17. * @ORM\GeneratedValue(strategy="AUTO")
  18. */
  19. private $id;
  20. /**
  21. * @ORM\Column(type="string", nullable=true, name="id_externo")
  22. */
  23. private $idExterno;
  24. /**
  25. * @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2024-01-01 00:00:00"})
  26. * @Gedmo\Timestampable(on="create")
  27. */
  28. private $createdAt;
  29. /**
  30. * @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2024-01-01 00:00:00"})
  31. * @Gedmo\Timestampable(on="update")
  32. */
  33. private $updatedAt;
  34. /**
  35. * @ORM\Column(type="datetime", nullable=true, name="deleted_at")
  36. */
  37. private $deletedAt;
  38. /**
  39. * @ORM\Column(type="json", nullable=true)
  40. */
  41. private $nombre;
  42. /**
  43. * @ORM\OneToMany(targetEntity=\App\Entity\SolicitudAccionFormativa::class, mappedBy="modalidad")
  44. */
  45. private $solicitudAccionFormativas;
  46. /**
  47. * @ORM\OneToMany(targetEntity=\App\Entity\GrupoSesiones::class, mappedBy="modalidad")
  48. */
  49. private $grupoSesiones;
  50. public function __construct()
  51. {
  52. $this->grupoSesiones = new ArrayCollection();
  53. $this->solicitudAccionFormativas = new ArrayCollection();
  54. }
  55. public function getId(): ?int
  56. {
  57. return $this->id;
  58. }
  59. public function setId($id)
  60. {
  61. $this->id = $id;
  62. return $this;
  63. }
  64. public function getIdExterno(): ?string
  65. {
  66. return $this->idExterno;
  67. }
  68. public function setIdExterno(?string $idExterno): static
  69. {
  70. $this->idExterno = $idExterno;
  71. return $this;
  72. }
  73. public function getCreatedAt(): ?\DateTimeInterface
  74. {
  75. return $this->createdAt;
  76. }
  77. public function setCreatedAt(\DateTimeInterface $createdAt): static
  78. {
  79. $this->createdAt = $createdAt;
  80. return $this;
  81. }
  82. public function getUpdatedAt(): ?\DateTimeInterface
  83. {
  84. return $this->updatedAt;
  85. }
  86. public function setUpdatedAt(\DateTimeInterface $updatedAt): static
  87. {
  88. $this->updatedAt = $updatedAt;
  89. return $this;
  90. }
  91. public function getDeletedAt(): ?\DateTimeInterface
  92. {
  93. return $this->deletedAt;
  94. }
  95. public function setDeletedAt(?\DateTimeInterface $deletedAt): static
  96. {
  97. $this->deletedAt = $deletedAt;
  98. return $this;
  99. }
  100. /**
  101. * @return Collection<int, GrupoSesiones>
  102. */
  103. public function getGrupoSesiones(): Collection
  104. {
  105. return $this->grupoSesiones;
  106. }
  107. public function addGrupoSesione(GrupoSesiones $grupoSesione): static
  108. {
  109. if (!$this->grupoSesiones->contains($grupoSesione)) {
  110. $this->grupoSesiones->add($grupoSesione);
  111. $grupoSesione->setModalidad($this);
  112. }
  113. return $this;
  114. }
  115. public function removeGrupoSesione(GrupoSesiones $grupoSesione): static
  116. {
  117. if ($this->grupoSesiones->removeElement($grupoSesione)) {
  118. // set the owning side to null (unless already changed)
  119. if ($grupoSesione->getModalidad() === $this) {
  120. $grupoSesione->setModalidad(null);
  121. }
  122. }
  123. return $this;
  124. }
  125. /**
  126. * @return Collection<int, SolicitudAccionFormativa>
  127. */
  128. public function getSolicitudAccionFormativas(): Collection
  129. {
  130. return $this->solicitudAccionFormativas;
  131. }
  132. public function addSolicitudAccionFormativa(SolicitudAccionFormativa $solicitudAccionFormativa): static
  133. {
  134. if (!$this->solicitudAccionFormativas->contains($solicitudAccionFormativa)) {
  135. $this->solicitudAccionFormativas->add($solicitudAccionFormativa);
  136. $solicitudAccionFormativa->setModalidad($this);
  137. }
  138. return $this;
  139. }
  140. public function removeSolicitudAccionFormativa(SolicitudAccionFormativa $solicitudAccionFormativa): static
  141. {
  142. if ($this->solicitudAccionFormativas->removeElement($solicitudAccionFormativa)) {
  143. // set the owning side to null (unless already changed)
  144. if ($solicitudAccionFormativa->getModalidad() === $this) {
  145. $solicitudAccionFormativa->setModalidad(null);
  146. }
  147. }
  148. return $this;
  149. }
  150. public function getNombre(): ?array
  151. {
  152. return $this->nombre;
  153. }
  154. public function setNombre(?array $nombre): static
  155. {
  156. $this->nombre = $nombre;
  157. return $this;
  158. }
  159. public function __toString(): string
  160. {
  161. if (empty($this->nombre)) return "";
  162. return isset($this->nombre[$_SERVER['LOCALE']]) ? $this->nombre[$_SERVER['LOCALE']] : reset($this->nombre);
  163. }
  164. }