src/Entity/ContenidoHTML.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="contenido_html")
  11. */
  12. class ContenidoHTML
  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)
  22. */
  23. private $slug;
  24. /**
  25. * @ORM\Column(type="json", nullable=true)
  26. */
  27. private $titulo;
  28. /**
  29. * @ORM\Column(type="json", nullable=true)
  30. */
  31. private $contenido;
  32. /**
  33. * @ORM\Column(type="boolean", nullable=true)
  34. */
  35. private $publico;
  36. /**
  37. * @ORM\Column(type="string", nullable=true, name="creado_por")
  38. */
  39. private $creadoPor;
  40. /**
  41. * @ORM\Column(type="datetime", nullable=true, name="deleted_at")
  42. */
  43. private $deletedAt;
  44. /**
  45. * @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2024-01-01 00:00:00"})
  46. * @Gedmo\Timestampable(on="update")
  47. */
  48. private $updatedAt;
  49. /**
  50. * @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2024-01-01 00:00:00"})
  51. * @Gedmo\Timestampable(on="create")
  52. */
  53. private $createdAt;
  54. /**
  55. * @ORM\OneToMany(targetEntity=\App\Entity\MenuItem::class, mappedBy="contenidoHTML")
  56. */
  57. private $menuItems;
  58. public function __construct()
  59. {
  60. $this->menuItems = new ArrayCollection();
  61. }
  62. public function getId(): ?int
  63. {
  64. return $this->id;
  65. }
  66. public function setId($id)
  67. {
  68. $this->id = $id;
  69. return $this;
  70. }
  71. public function getSlug(): ?string
  72. {
  73. return $this->slug;
  74. }
  75. public function setSlug(?string $slug): static
  76. {
  77. $this->slug = $slug;
  78. return $this;
  79. }
  80. public function getTitulo(): ?array
  81. {
  82. return $this->titulo;
  83. }
  84. public function setTitulo(?array $titulo): static
  85. {
  86. $this->titulo = $titulo;
  87. return $this;
  88. }
  89. public function getContenido(): ?array
  90. {
  91. return $this->contenido;
  92. }
  93. public function setContenido(?array $contenido): static
  94. {
  95. $this->contenido = $contenido;
  96. return $this;
  97. }
  98. public function isPublico(): ?bool
  99. {
  100. return $this->publico;
  101. }
  102. public function setPublico(?bool $publico): static
  103. {
  104. $this->publico = $publico;
  105. return $this;
  106. }
  107. public function getCreadoPor(): ?string
  108. {
  109. return $this->creadoPor;
  110. }
  111. public function setCreadoPor(?string $creadoPor): static
  112. {
  113. $this->creadoPor = $creadoPor;
  114. return $this;
  115. }
  116. public function getDeletedAt(): ?\DateTimeInterface
  117. {
  118. return $this->deletedAt;
  119. }
  120. public function setDeletedAt(?\DateTimeInterface $deletedAt): static
  121. {
  122. $this->deletedAt = $deletedAt;
  123. return $this;
  124. }
  125. public function getUpdatedAt(): ?\DateTimeInterface
  126. {
  127. return $this->updatedAt;
  128. }
  129. public function setUpdatedAt(\DateTimeInterface $updatedAt): static
  130. {
  131. $this->updatedAt = $updatedAt;
  132. return $this;
  133. }
  134. public function getCreatedAt(): ?\DateTimeInterface
  135. {
  136. return $this->createdAt;
  137. }
  138. public function setCreatedAt(\DateTimeInterface $createdAt): static
  139. {
  140. $this->createdAt = $createdAt;
  141. return $this;
  142. }
  143. /**
  144. * @return Collection<int, MenuItem>
  145. */
  146. public function getMenuItems(): Collection
  147. {
  148. return $this->menuItems;
  149. }
  150. public function addMenuItem(MenuItem $menuItem): static
  151. {
  152. if (!$this->menuItems->contains($menuItem)) {
  153. $this->menuItems->add($menuItem);
  154. $menuItem->setContenidoHTML($this);
  155. }
  156. return $this;
  157. }
  158. public function removeMenuItem(MenuItem $menuItem): static
  159. {
  160. if ($this->menuItems->removeElement($menuItem)) {
  161. // set the owning side to null (unless already changed)
  162. if ($menuItem->getContenidoHTML() === $this) {
  163. $menuItem->setContenidoHTML(null);
  164. }
  165. }
  166. return $this;
  167. }
  168. }