src/Entity/CategoriaComunicacion.php line 14

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\ORM\Mapping as ORM;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. /**
  8. * @ORM\Entity
  9. * @ORM\Table(name="categoria_comunicacion")
  10. */
  11. class CategoriaComunicacion
  12. {
  13. /**
  14. * @ORM\Id
  15. * @ORM\Column(type="integer")
  16. * @ORM\GeneratedValue(strategy="AUTO")
  17. */
  18. private $id;
  19. /**
  20. * @ORM\Column(type="string", nullable=true)
  21. */
  22. private $nombre;
  23. /**
  24. * @ORM\Column(type="string", nullable=true)
  25. */
  26. private $alias;
  27. /**
  28. * @ORM\Column(type="datetime", nullable=true, name="deleted_at")
  29. */
  30. private $deletedAt;
  31. /**
  32. * @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2024-01-01 00:00:00"})
  33. * @Gedmo\Timestampable(on="update")
  34. */
  35. private $updatedAt;
  36. /**
  37. * @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2024-01-01 00:00:00"})
  38. * @Gedmo\Timestampable(on="create")
  39. */
  40. private $createdAt;
  41. /**
  42. * @ORM\ManyToMany(targetEntity=\App\Entity\Comunicacion::class, mappedBy="categorias")
  43. */
  44. private $comunicaciones;
  45. public function __construct()
  46. {
  47. $this->comunicaciones = new ArrayCollection();
  48. }
  49. public function __toString(): string
  50. {
  51. return $this->nombre ?? '';
  52. }
  53. public function getId(): ?int
  54. {
  55. return $this->id;
  56. }
  57. public function setId($id): static
  58. {
  59. $this->id = $id;
  60. return $this;
  61. }
  62. public function getNombre(): ?string
  63. {
  64. return $this->nombre;
  65. }
  66. public function setNombre(?string $nombre): static
  67. {
  68. $this->nombre = $nombre;
  69. return $this;
  70. }
  71. public function getAlias(): ?string
  72. {
  73. return $this->alias;
  74. }
  75. public function setAlias(?string $alias): static
  76. {
  77. $this->alias = $alias;
  78. return $this;
  79. }
  80. public function getDeletedAt(): ?\DateTimeInterface
  81. {
  82. return $this->deletedAt;
  83. }
  84. public function setDeletedAt(?\DateTimeInterface $deletedAt): static
  85. {
  86. $this->deletedAt = $deletedAt;
  87. return $this;
  88. }
  89. public function getUpdatedAt(): ?\DateTimeInterface
  90. {
  91. return $this->updatedAt;
  92. }
  93. public function setUpdatedAt(\DateTimeInterface $updatedAt): static
  94. {
  95. $this->updatedAt = $updatedAt;
  96. return $this;
  97. }
  98. public function getCreatedAt(): ?\DateTimeInterface
  99. {
  100. return $this->createdAt;
  101. }
  102. public function setCreatedAt(\DateTimeInterface $createdAt): static
  103. {
  104. $this->createdAt = $createdAt;
  105. return $this;
  106. }
  107. /**
  108. * @return Collection<int, Comunicacion>
  109. */
  110. public function getComunicaciones(): Collection
  111. {
  112. return $this->comunicaciones;
  113. }
  114. public function addComunicacion(Comunicacion $comunicacion): static
  115. {
  116. if (!$this->comunicaciones->contains($comunicacion)) {
  117. $this->comunicaciones->add($comunicacion);
  118. $comunicacion->addCategoria($this);
  119. }
  120. return $this;
  121. }
  122. public function removeComunicacion(Comunicacion $comunicacion): static
  123. {
  124. if ($this->comunicaciones->removeElement($comunicacion)) {
  125. $comunicacion->removeCategoria($this);
  126. }
  127. return $this;
  128. }
  129. }