src/Entity/Municipio.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="municipio")
  11. */
  12. class Municipio
  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="id_externo")
  22. */
  23. private $idExterno;
  24. /**
  25. * @ORM\Column(type="json", nullable=true)
  26. */
  27. private $nombre;
  28. /**
  29. * @ORM\Column(type="json", nullable=true)
  30. */
  31. private $__data;
  32. /**
  33. * @ORM\Column(type="datetime", nullable=true, name="deleted_at")
  34. */
  35. private $deletedAt;
  36. /**
  37. * @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2024-01-01 00:00:00"})
  38. * @Gedmo\Timestampable(on="update")
  39. */
  40. private $updatedAt;
  41. /**
  42. * @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2024-01-01 00:00:00"})
  43. * @Gedmo\Timestampable(on="create")
  44. */
  45. private $createdAt;
  46. /**
  47. * @ORM\OneToMany(targetEntity=\App\Entity\CentroFormacion::class, mappedBy="municipio")
  48. */
  49. private $centros;
  50. public function __construct()
  51. {
  52. $this->centros = new ArrayCollection();
  53. }
  54. public function getId(): ?int
  55. {
  56. return $this->id;
  57. }
  58. public function setId($id)
  59. {
  60. $this->id = $id;
  61. return $this;
  62. }
  63. public function getIdExterno(): ?string
  64. {
  65. return $this->idExterno;
  66. }
  67. public function setIdExterno(?string $idExterno): static
  68. {
  69. $this->idExterno = $idExterno;
  70. return $this;
  71. }
  72. public function getNombre(): ?array
  73. {
  74. return $this->nombre;
  75. }
  76. public function setNombre(?array $nombre): static
  77. {
  78. $this->nombre = $nombre;
  79. return $this;
  80. }
  81. public function getData(): ?array
  82. {
  83. return $this->__data;
  84. }
  85. public function setData(?array $__data): static
  86. {
  87. $this->__data = $__data;
  88. return $this;
  89. }
  90. public function getDeletedAt(): ?\DateTimeInterface
  91. {
  92. return $this->deletedAt;
  93. }
  94. public function setDeletedAt(?\DateTimeInterface $deletedAt): static
  95. {
  96. $this->deletedAt = $deletedAt;
  97. return $this;
  98. }
  99. public function getUpdatedAt(): ?\DateTimeInterface
  100. {
  101. return $this->updatedAt;
  102. }
  103. public function setUpdatedAt(\DateTimeInterface $updatedAt): static
  104. {
  105. $this->updatedAt = $updatedAt;
  106. return $this;
  107. }
  108. public function getCreatedAt(): ?\DateTimeInterface
  109. {
  110. return $this->createdAt;
  111. }
  112. public function setCreatedAt(\DateTimeInterface $createdAt): static
  113. {
  114. $this->createdAt = $createdAt;
  115. return $this;
  116. }
  117. /**
  118. * @return Collection<int, CentroFormacion>
  119. */
  120. public function getCentros(): Collection
  121. {
  122. return $this->centros;
  123. }
  124. public function addCentro(CentroFormacion $centro): static
  125. {
  126. if (!$this->centros->contains($centro)) {
  127. $this->centros->add($centro);
  128. $centro->setMunicipio($this);
  129. }
  130. return $this;
  131. }
  132. public function removeCentro(CentroFormacion $centro): static
  133. {
  134. if ($this->centros->removeElement($centro)) {
  135. // set the owning side to null (unless already changed)
  136. if ($centro->getMunicipio() === $this) {
  137. $centro->setMunicipio(null);
  138. }
  139. }
  140. return $this;
  141. }
  142. public function __toString(): string
  143. {
  144. return isset($this->nombre[$_SERVER['LOCALE']]) ? $this->nombre[$_SERVER['LOCALE']] : reset($this->nombre);
  145. }
  146. }