src/Entity/Competencia.php line 16

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. use Symfony\Component\Uid\Uuid;
  8. /**
  9. * @ORM\Entity(repositoryClass="App\Repository\CompetenciaRepository")
  10. * @ORM\Table(name="competencia", schema="perseo")
  11. * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
  12. */
  13. class Competencia
  14. {
  15. /**
  16. * @ORM\Id
  17. * @ORM\Column(type="uuid", unique=true)
  18. * @ORM\GeneratedValue(strategy="CUSTOM")
  19. * @ORM\CustomIdGenerator(class="doctrine.uuid_generator")
  20. */
  21. private $id;
  22. /**
  23. * @ORM\Column(type="string", nullable=true)
  24. */
  25. private $nombre;
  26. /**
  27. * @ORM\Column(type="string", nullable=true)
  28. */
  29. private $descripcion;
  30. /**
  31. * @ORM\Column(type="smallint", length=2, nullable=true, options={"default":0})
  32. */
  33. private $orden;
  34. /**
  35. * @ORM\Column(type="datetime", nullable=true, name="deleted_at")
  36. */
  37. private $deletedAt;
  38. /**
  39. * @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2022-01-01 00:00:00"})
  40. * @Gedmo\Timestampable(on="update")
  41. */
  42. private $updatedAt;
  43. /**
  44. * @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2022-01-01 00:00:00"})
  45. * @Gedmo\Timestampable(on="create")
  46. */
  47. private $createdAt;
  48. /**
  49. * @ORM\OneToMany(targetEntity="App\Entity\AccionCompetencia", mappedBy="competencia")
  50. */
  51. private $accionesCompetencia;
  52. public function __construct()
  53. {
  54. $this->accionesCompetencia = new ArrayCollection();
  55. }
  56. public function __toString(): string
  57. {
  58. return $this->getNombre() ?? '---';
  59. }
  60. public function getId(): ?Uuid
  61. {
  62. return $this->id;
  63. }
  64. public function getNombre(): ?string
  65. {
  66. return $this->nombre;
  67. }
  68. public function setNombre(?string $nombre): self
  69. {
  70. $this->nombre = $nombre;
  71. return $this;
  72. }
  73. public function getDescripcion(): ?string
  74. {
  75. return $this->descripcion;
  76. }
  77. public function setDescripcion(?string $descripcion): self
  78. {
  79. $this->descripcion = $descripcion;
  80. return $this;
  81. }
  82. public function getOrden(): ?int
  83. {
  84. return $this->orden;
  85. }
  86. public function setOrden(?int $orden): self
  87. {
  88. $this->orden = $orden;
  89. return $this;
  90. }
  91. public function getDeletedAt(): ?\DateTimeInterface
  92. {
  93. return $this->deletedAt;
  94. }
  95. public function setDeletedAt(?\DateTimeInterface $deletedAt): self
  96. {
  97. $this->deletedAt = $deletedAt;
  98. return $this;
  99. }
  100. public function getUpdatedAt(): ?\DateTimeInterface
  101. {
  102. return $this->updatedAt;
  103. }
  104. public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  105. {
  106. $this->updatedAt = $updatedAt;
  107. return $this;
  108. }
  109. public function getCreatedAt(): ?\DateTimeInterface
  110. {
  111. return $this->createdAt;
  112. }
  113. public function setCreatedAt(\DateTimeInterface $createdAt): self
  114. {
  115. $this->createdAt = $createdAt;
  116. return $this;
  117. }
  118. /**
  119. * @return Collection<int, AccionCompetencia>
  120. */
  121. public function getAccionesCompetencia(): Collection
  122. {
  123. return $this->accionesCompetencia;
  124. }
  125. public function addAccionesCompetencium(AccionCompetencia $accionesCompetencium): self
  126. {
  127. if (!$this->accionesCompetencia->contains($accionesCompetencium)) {
  128. $this->accionesCompetencia->add($accionesCompetencium);
  129. $accionesCompetencium->setCompetencia($this);
  130. }
  131. return $this;
  132. }
  133. public function removeAccionesCompetencium(AccionCompetencia $accionesCompetencium): self
  134. {
  135. if ($this->accionesCompetencia->removeElement($accionesCompetencium)) {
  136. // set the owning side to null (unless already changed)
  137. if ($accionesCompetencium->getCompetencia() === $this) {
  138. $accionesCompetencium->setCompetencia(null);
  139. }
  140. }
  141. return $this;
  142. }
  143. }