src/Entity/CategoriaNoticia.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="categoria_noticia")
  11. */
  12. class CategoriaNoticia
  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 $nombre;
  24. /**
  25. * @ORM\Column(type="boolean", nullable=true)
  26. */
  27. private $publica;
  28. /**
  29. * @ORM\Column(type="datetime", nullable=true, name="deleted_at")
  30. */
  31. private $deletedAt;
  32. /**
  33. * @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2024-01-01 00:00:00"})
  34. * @Gedmo\Timestampable(on="update")
  35. */
  36. private $updatedAt;
  37. /**
  38. * @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2024-01-01 00:00:00"})
  39. * @Gedmo\Timestampable(on="create")
  40. */
  41. private $createdAt;
  42. /**
  43. * @ORM\OneToMany(targetEntity=\App\Entity\Noticia::class, mappedBy="categoriaNoticia")
  44. */
  45. private $noticias;
  46. public function __construct()
  47. {
  48. $this->noticias = new ArrayCollection();
  49. }
  50. public function getId(): ?int
  51. {
  52. return $this->id;
  53. }
  54. public function setId($id)
  55. {
  56. $this->id = $id;
  57. return $this;
  58. }
  59. public function getNombre(): ?string
  60. {
  61. return $this->nombre;
  62. }
  63. public function setNombre(?string $nombre): static
  64. {
  65. $this->nombre = $nombre;
  66. return $this;
  67. }
  68. public function isPublica(): ?bool
  69. {
  70. return $this->publica;
  71. }
  72. public function setPublica(?bool $publica): static
  73. {
  74. $this->publica = $publica;
  75. return $this;
  76. }
  77. public function getDeletedAt(): ?\DateTimeInterface
  78. {
  79. return $this->deletedAt;
  80. }
  81. public function setDeletedAt(?\DateTimeInterface $deletedAt): static
  82. {
  83. $this->deletedAt = $deletedAt;
  84. return $this;
  85. }
  86. public function getUpdatedAt(): ?\DateTimeInterface
  87. {
  88. return $this->updatedAt;
  89. }
  90. public function setUpdatedAt(\DateTimeInterface $updatedAt): static
  91. {
  92. $this->updatedAt = $updatedAt;
  93. return $this;
  94. }
  95. public function getCreatedAt(): ?\DateTimeInterface
  96. {
  97. return $this->createdAt;
  98. }
  99. public function setCreatedAt(\DateTimeInterface $createdAt): static
  100. {
  101. $this->createdAt = $createdAt;
  102. return $this;
  103. }
  104. /**
  105. * @return Collection<int, Noticia>
  106. */
  107. public function getNoticias(): Collection
  108. {
  109. return $this->noticias;
  110. }
  111. public function addNoticia(Noticia $noticia): static
  112. {
  113. if (!$this->noticias->contains($noticia)) {
  114. $this->noticias->add($noticia);
  115. $noticia->setCategoriaNoticia($this);
  116. }
  117. return $this;
  118. }
  119. public function removeNoticia(Noticia $noticia): static
  120. {
  121. if ($this->noticias->removeElement($noticia)) {
  122. // set the owning side to null (unless already changed)
  123. if ($noticia->getCategoriaNoticia() === $this) {
  124. $noticia->setCategoriaNoticia(null);
  125. }
  126. }
  127. return $this;
  128. }
  129. }