src/Entity/Firmante.php line 19

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\HttpFoundation\File\File;
  8. use Symfony\Component\Uid\Uuid;
  9. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  10. /**
  11. * @ORM\Entity(repositoryClass="App\Repository\FirmanteRepository")
  12. * @ORM\Table(name="firmante", schema="perseo")
  13. * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
  14. * @Vich\Uploadable
  15. */
  16. class Firmante
  17. {
  18. /**
  19. * @ORM\Id
  20. * @ORM\Column(type="uuid", unique=true)
  21. * @ORM\GeneratedValue(strategy="CUSTOM")
  22. * @ORM\CustomIdGenerator(class="doctrine.uuid_generator")
  23. */
  24. private $id;
  25. /**
  26. * @ORM\Column(type="string", nullable=true)
  27. */
  28. private $tipo;
  29. /**
  30. * @ORM\Column(type="string", length=2, nullable=true)
  31. */
  32. private $idioma;
  33. /**
  34. * @ORM\Column(type="string", nullable=true)
  35. */
  36. private $nombre;
  37. /**
  38. * @ORM\Column(type="string", nullable=true)
  39. */
  40. private $dni;
  41. /**
  42. * @ORM\Column(type="string", nullable=true)
  43. */
  44. private $firma;
  45. /**
  46. * @Vich\UploadableField(mapping="firmante", fileNameProperty="firma")
  47. * @var File
  48. */
  49. private $firmaFile;
  50. /**
  51. * @ORM\Column(type="text", nullable=true)
  52. */
  53. private $descripcion;
  54. /**
  55. * @ORM\Column(type="boolean", nullable=true)
  56. */
  57. private $active;
  58. /**
  59. * @ORM\Column(type="datetime", nullable=true, name="deleted_at")
  60. */
  61. private $deletedAt;
  62. /**
  63. * @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2022-01-01 00:00:00"})
  64. * @Gedmo\Timestampable(on="update")
  65. */
  66. private $updatedAt;
  67. /**
  68. * @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2022-01-01 00:00:00"})
  69. * @Gedmo\Timestampable(on="create")
  70. */
  71. private $createdAt;
  72. /**
  73. * @ORM\OneToMany(targetEntity="App\Entity\Operacion", mappedBy="firmante")
  74. */
  75. private $operaciones;
  76. public function __construct()
  77. {
  78. $this->operaciones = new ArrayCollection();
  79. }
  80. public function __toString(): string
  81. {
  82. return $this->getNombre()??'---';
  83. }
  84. public function getId(): ?Uuid
  85. {
  86. return $this->id;
  87. }
  88. public function getNombre(): ?string
  89. {
  90. return $this->nombre;
  91. }
  92. public function setNombre(?string $nombre): self
  93. {
  94. $this->nombre = $nombre;
  95. return $this;
  96. }
  97. public function getDni(): ?string
  98. {
  99. return $this->dni;
  100. }
  101. public function setDni(?string $dni): self
  102. {
  103. $this->dni = $dni;
  104. return $this;
  105. }
  106. public function getFirma(): ?string
  107. {
  108. return $this->firma;
  109. }
  110. public function setFirma(?string $firma): self
  111. {
  112. $this->firma = $firma;
  113. return $this;
  114. }
  115. public function getDescripcion(): ?string
  116. {
  117. return $this->descripcion;
  118. }
  119. public function setDescripcion(?string $descripcion): self
  120. {
  121. $this->descripcion = $descripcion;
  122. return $this;
  123. }
  124. public function getDeletedAt(): ?\DateTimeInterface
  125. {
  126. return $this->deletedAt;
  127. }
  128. public function setDeletedAt(?\DateTimeInterface $deletedAt): self
  129. {
  130. $this->deletedAt = $deletedAt;
  131. return $this;
  132. }
  133. public function getUpdatedAt(): ?\DateTimeInterface
  134. {
  135. return $this->updatedAt;
  136. }
  137. public function setUpdatedAt(\DateTimeInterface $updatedAt): self
  138. {
  139. $this->updatedAt = $updatedAt;
  140. return $this;
  141. }
  142. public function getCreatedAt(): ?\DateTimeInterface
  143. {
  144. return $this->createdAt;
  145. }
  146. public function setCreatedAt(\DateTimeInterface $createdAt): self
  147. {
  148. $this->createdAt = $createdAt;
  149. return $this;
  150. }
  151. /**
  152. * @return Collection|Operacion[]
  153. */
  154. public function getOperaciones(): Collection
  155. {
  156. return $this->operaciones;
  157. }
  158. public function addOperacione(Operacion $operacione): self
  159. {
  160. if (!$this->operaciones->contains($operacione)) {
  161. $this->operaciones[] = $operacione;
  162. $operacione->setFirmante($this);
  163. }
  164. return $this;
  165. }
  166. public function removeOperacione(Operacion $operacione): self
  167. {
  168. if ($this->operaciones->removeElement($operacione)) {
  169. // set the owning side to null (unless already changed)
  170. if ($operacione->getFirmante() === $this) {
  171. $operacione->setFirmante(null);
  172. }
  173. }
  174. return $this;
  175. }
  176. public function isActive(): ?bool
  177. {
  178. return $this->active;
  179. }
  180. public function setActive(?bool $active): static
  181. {
  182. $this->active = $active;
  183. return $this;
  184. }
  185. public function getFirmaFile(): ?File
  186. {
  187. return $this->firmaFile;
  188. }
  189. public function setFirmaFile(?File $firmaFile): self
  190. {
  191. $this->firmaFile = $firmaFile;
  192. if ($firmaFile) {
  193. // if 'updatedAt' is not defined in your entity, use another property
  194. $this->setUpdatedAt(new \DateTime('now'));
  195. }
  196. return $this;
  197. }
  198. public function getTipo(): ?string
  199. {
  200. return $this->tipo;
  201. }
  202. public function setTipo(?string $tipo): static
  203. {
  204. $this->tipo = $tipo;
  205. return $this;
  206. }
  207. public function getIdioma(): ?string
  208. {
  209. return $this->idioma;
  210. }
  211. public function setIdioma(?string $idioma): static
  212. {
  213. $this->idioma = $idioma;
  214. return $this;
  215. }
  216. }