src/Entity/MenuItem.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="menu_item")
  11. */
  12. class MenuItem
  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="key_menu")
  22. */
  23. private $key;
  24. /**
  25. * @ORM\Column(type="string", nullable=true)
  26. */
  27. private $categoria;
  28. /**
  29. * @ORM\Column(type="string", nullable=true)
  30. */
  31. private $titulo;
  32. /**
  33. * @ORM\Column(type="string", nullable=true)
  34. */
  35. private $enlace;
  36. /**
  37. * @ORM\Column(type="string", nullable=true)
  38. */
  39. private $ruta;
  40. /**
  41. * @ORM\Column(type="json", nullable=true)
  42. */
  43. private $params;
  44. /**
  45. * @ORM\Column(type="integer", nullable=true)
  46. */
  47. private $orden;
  48. /**
  49. * @ORM\Column(type="string", nullable=true)
  50. */
  51. private $icon;
  52. /**
  53. * @ORM\Column(type="datetime", nullable=true, name="deleted_at")
  54. */
  55. private $deletedAt;
  56. /**
  57. * @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2024-01-01 00:00:00"})
  58. * @Gedmo\Timestampable(on="update")
  59. */
  60. private $updatedAt;
  61. /**
  62. * @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2024-01-01 00:00:00"})
  63. * @Gedmo\Timestampable(on="create")
  64. */
  65. private $createdAt;
  66. /**
  67. * @ORM\OneToMany(targetEntity=\App\Entity\MenuItem::class, mappedBy="padre")
  68. */
  69. private $hijos;
  70. /**
  71. * @ORM\ManyToOne(targetEntity=\App\Entity\MenuItem::class, inversedBy="hijos")
  72. * @ORM\JoinColumn(name="menu_item_id", referencedColumnName="id")
  73. */
  74. private $padre;
  75. /**
  76. * @ORM\ManyToOne(targetEntity=\App\Entity\ContenidoHTML::class, inversedBy="menuItems")
  77. * @ORM\JoinColumn(name="contenido_html_id", referencedColumnName="id")
  78. */
  79. private $contenidoHTML;
  80. public function __construct()
  81. {
  82. $this->hijos = new ArrayCollection();
  83. }
  84. public function getId(): ?int
  85. {
  86. return $this->id;
  87. }
  88. public function setId($id)
  89. {
  90. $this->id = $id;
  91. return $this;
  92. }
  93. public function getKey(): ?string
  94. {
  95. return $this->key;
  96. }
  97. public function setKey(?string $key): static
  98. {
  99. $this->key = $key;
  100. return $this;
  101. }
  102. public function getCategoria(): ?string
  103. {
  104. return $this->categoria;
  105. }
  106. public function setCategoria(?string $categoria): static
  107. {
  108. $this->categoria = $categoria;
  109. return $this;
  110. }
  111. public function getTitulo(): ?string
  112. {
  113. return $this->titulo;
  114. }
  115. public function setTitulo(?string $titulo): static
  116. {
  117. $this->titulo = $titulo;
  118. return $this;
  119. }
  120. public function getEnlace(): ?string
  121. {
  122. return $this->enlace;
  123. }
  124. public function setEnlace(?string $enlace): static
  125. {
  126. $this->enlace = $enlace;
  127. return $this;
  128. }
  129. public function getRuta(): ?string
  130. {
  131. return $this->ruta;
  132. }
  133. public function setRuta(?string $ruta): static
  134. {
  135. $this->ruta = $ruta;
  136. return $this;
  137. }
  138. public function getParams(): ?array
  139. {
  140. return $this->params;
  141. }
  142. public function setParams(?array $params): static
  143. {
  144. $this->params = $params;
  145. return $this;
  146. }
  147. public function getOrden(): ?int
  148. {
  149. return $this->orden;
  150. }
  151. public function setOrden(?int $orden): static
  152. {
  153. $this->orden = $orden;
  154. return $this;
  155. }
  156. public function getIcon(): ?string
  157. {
  158. return $this->icon;
  159. }
  160. public function setIcon(?string $icon): static
  161. {
  162. $this->icon = $icon;
  163. return $this;
  164. }
  165. public function getDeletedAt(): ?\DateTimeInterface
  166. {
  167. return $this->deletedAt;
  168. }
  169. public function setDeletedAt(?\DateTimeInterface $deletedAt): static
  170. {
  171. $this->deletedAt = $deletedAt;
  172. return $this;
  173. }
  174. public function getUpdatedAt(): ?\DateTimeInterface
  175. {
  176. return $this->updatedAt;
  177. }
  178. public function setUpdatedAt(\DateTimeInterface $updatedAt): static
  179. {
  180. $this->updatedAt = $updatedAt;
  181. return $this;
  182. }
  183. public function getCreatedAt(): ?\DateTimeInterface
  184. {
  185. return $this->createdAt;
  186. }
  187. public function setCreatedAt(\DateTimeInterface $createdAt): static
  188. {
  189. $this->createdAt = $createdAt;
  190. return $this;
  191. }
  192. /**
  193. * @return Collection<int, MenuItem>
  194. */
  195. public function getHijos(): Collection
  196. {
  197. return $this->hijos;
  198. }
  199. public function addHijo(MenuItem $hijo): static
  200. {
  201. if (!$this->hijos->contains($hijo)) {
  202. $this->hijos->add($hijo);
  203. $hijo->setPadre($this);
  204. }
  205. return $this;
  206. }
  207. public function removeHijo(MenuItem $hijo): static
  208. {
  209. if ($this->hijos->removeElement($hijo)) {
  210. // set the owning side to null (unless already changed)
  211. if ($hijo->getPadre() === $this) {
  212. $hijo->setPadre(null);
  213. }
  214. }
  215. return $this;
  216. }
  217. public function getPadre(): ?self
  218. {
  219. return $this->padre;
  220. }
  221. public function setPadre(?self $padre): static
  222. {
  223. $this->padre = $padre;
  224. return $this;
  225. }
  226. public function getContenidoHTML(): ?ContenidoHTML
  227. {
  228. return $this->contenidoHTML;
  229. }
  230. public function setContenidoHTML(?ContenidoHTML $contenidoHTML): static
  231. {
  232. $this->contenidoHTML = $contenidoHTML;
  233. return $this;
  234. }
  235. }