src/Entity/Entidad.php line 26

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use DateTime;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\DBAL\Types\Types;
  7. use Doctrine\ORM\Mapping as ORM;
  8. use Symfony\Component\HttpFoundation\File\File;
  9. use Vich\UploaderBundle\Mapping\Annotation as Vich;
  10. /**
  11. * @ORM\Entity
  12. * @ORM\Table(name="entidad")
  13. * @ORM\InheritanceType("SINGLE_TABLE")
  14. * @ORM\DiscriminatorColumn(name="type", type="string")
  15. * @ORM\DiscriminatorMap({
  16. * "empresa":"App\Entity\Empresa",
  17. * "entidad_colaboradora":"App\Entity\EntidadColaboradora",
  18. * "entidad_representativa":"App\Entity\EntidadRepresentativa",
  19. * "consorci":"App\Entity\Consorci"
  20. * })
  21. */
  22. #[Vich\Uploadable]
  23. abstract class Entidad extends BaseEntity
  24. {
  25. /**
  26. * @ORM\Id
  27. * @ORM\Column(type="integer")
  28. * @ORM\GeneratedValue(strategy="AUTO")
  29. */
  30. protected $id;
  31. /**
  32. * @ORM\Column(type="string", nullable=true, name="id_externo")
  33. */
  34. protected $idExterno;
  35. /**
  36. * @ORM\Column(type="string", nullable=true)
  37. */
  38. protected $foto;
  39. /**
  40. * @var File
  41. */
  42. #[Vich\UploadableField(mapping: 'propietario', fileNameProperty: 'foto')]
  43. protected $fotoFile;
  44. /**
  45. * @ORM\Column(type="string", nullable=true)
  46. */
  47. protected $razonSocial;
  48. /**
  49. * @ORM\Column(type="string", nullable=true, name="nombre_comercial")
  50. */
  51. protected $nombreComercial;
  52. /**
  53. * @ORM\Column(type="string", nullable=true, options={"comment":"siendo el dni, cif, nif, nie, etc ... "})
  54. */
  55. protected $identificador;
  56. /**
  57. * @ORM\Column(type="string", nullable=true)
  58. */
  59. protected $nss;
  60. /**
  61. * @ORM\Column(type="text", nullable=true)
  62. */
  63. protected $descripcion;
  64. /**
  65. * @ORM\Column(type="string", nullable=true)
  66. */
  67. protected $correo;
  68. /**
  69. * @ORM\Column(type="json", nullable=true)
  70. */
  71. protected $rrss;
  72. /**
  73. * @ORM\Column(type="string", nullable=true)
  74. */
  75. protected $web;
  76. /**
  77. * @ORM\Column(type="string", nullable=true, options={"comment":"Datos de la persona de contacto de la entidad"})
  78. */
  79. protected $contactoNombre;
  80. /**
  81. * @ORM\Column(type="string", nullable=true)
  82. */
  83. protected $contactoApellidos;
  84. /**
  85. * @ORM\Column(type="boolean", nullable=true, name="info_public")
  86. */
  87. protected $infoPublic;
  88. /**
  89. * @ORM\Column(type="boolean", nullable=true, name="info_profile_public")
  90. */
  91. protected $infoProfilePublic;
  92. /**
  93. * @ORM\Column(type="string", nullable=true)
  94. */
  95. protected $direccion;
  96. /**
  97. * @ORM\Column(type="string", nullable=true)
  98. */
  99. protected $numero;
  100. /**
  101. * @ORM\Column(type="string", nullable=true)
  102. */
  103. protected $escalera;
  104. /**
  105. * @ORM\Column(type="string", nullable=true)
  106. */
  107. protected $piso;
  108. /**
  109. * @ORM\Column(type="string", nullable=true)
  110. */
  111. protected $planta;
  112. /**
  113. * @ORM\Column(type="string", nullable=true)
  114. */
  115. protected $puerta;
  116. /**
  117. * @ORM\Column(type="string", nullable=true)
  118. */
  119. protected $cp;
  120. /**
  121. * @ORM\Column(type="string", nullable=true)
  122. */
  123. protected $poblacion;
  124. /**
  125. * @ORM\Column(type="string", nullable=true)
  126. */
  127. protected $provincia;
  128. /**
  129. * @ORM\Column(type="string", nullable=true)
  130. */
  131. protected $telefonos;
  132. /**
  133. * @ORM\Column(type="string", nullable=true)
  134. */
  135. protected $pais;
  136. /**
  137. * @ORM\Column(type="json", nullable=true)
  138. */
  139. protected $imagenes;
  140. /**
  141. * @ORM\Column(type="boolean", nullable=true, options={"default":1})
  142. */
  143. protected $activo;
  144. /**
  145. * @ORM\Column(type="datetime", nullable=true, name="deleted_at")
  146. */
  147. protected $deletedAt;
  148. /**
  149. * @ORM\Column(type="datetime", nullable=false, name="updated_at", options={"default":"2024-01-01 00:00:00"})
  150. */
  151. protected $updatedAt;
  152. /**
  153. * @ORM\Column(type="datetime", nullable=false, name="created_at", options={"default":"2024-01-01 00:00:00"})
  154. */
  155. protected $createdAt;
  156. /**
  157. * @ORM\OneToMany(targetEntity=\App\Entity\Recurso::class, mappedBy="entidad")
  158. */
  159. private $recursos;
  160. public function __construct()
  161. {
  162. $this->recursos = new ArrayCollection();
  163. }
  164. public function getId(): ?int
  165. {
  166. return $this->id;
  167. }
  168. public function getIdExterno(): ?string
  169. {
  170. return $this->idExterno;
  171. }
  172. public function setIdExterno(?string $idExterno): static
  173. {
  174. $this->idExterno = $idExterno;
  175. return $this;
  176. }
  177. public function getRazonSocial(): ?string
  178. {
  179. return $this->razonSocial;
  180. }
  181. public function setRazonSocial(?string $razonSocial): static
  182. {
  183. $this->razonSocial = $razonSocial;
  184. return $this;
  185. }
  186. public function getIdentificador(): ?string
  187. {
  188. return $this->identificador;
  189. }
  190. public function setIdentificador(?string $identificador): static
  191. {
  192. $this->identificador = $identificador;
  193. return $this;
  194. }
  195. public function getCorreo(): ?string
  196. {
  197. return $this->correo;
  198. }
  199. public function setCorreo(?string $correo): static
  200. {
  201. $this->correo = $correo;
  202. return $this;
  203. }
  204. public function getDireccion(): ?string
  205. {
  206. return $this->direccion;
  207. }
  208. public function setDireccion(?string $direccion): static
  209. {
  210. $this->direccion = $direccion;
  211. return $this;
  212. }
  213. public function getNumero(): ?string
  214. {
  215. return $this->numero;
  216. }
  217. public function setNumero(?string $numero): static
  218. {
  219. $this->numero = $numero;
  220. return $this;
  221. }
  222. public function getEscalera(): ?string
  223. {
  224. return $this->escalera;
  225. }
  226. public function setEscalera(?string $escalera): static
  227. {
  228. $this->escalera = $escalera;
  229. return $this;
  230. }
  231. public function getPiso(): ?string
  232. {
  233. return $this->piso;
  234. }
  235. public function setPiso(?string $piso): static
  236. {
  237. $this->piso = $piso;
  238. return $this;
  239. }
  240. public function getPlanta(): ?string
  241. {
  242. return $this->planta;
  243. }
  244. public function setPlanta(?string $planta): static
  245. {
  246. $this->planta = $planta;
  247. return $this;
  248. }
  249. public function getPuerta(): ?string
  250. {
  251. return $this->puerta;
  252. }
  253. public function setPuerta(?string $puerta): static
  254. {
  255. $this->puerta = $puerta;
  256. return $this;
  257. }
  258. public function getCp(): ?string
  259. {
  260. return $this->cp;
  261. }
  262. public function setCp(?string $cp): static
  263. {
  264. $this->cp = $cp;
  265. return $this;
  266. }
  267. public function getPoblacion(): ?string
  268. {
  269. return $this->poblacion;
  270. }
  271. public function setPoblacion(?string $poblacion): static
  272. {
  273. $this->poblacion = $poblacion;
  274. return $this;
  275. }
  276. public function getProvincia(): ?string
  277. {
  278. return $this->provincia;
  279. }
  280. public function setProvincia(?string $provincia): static
  281. {
  282. $this->provincia = $provincia;
  283. return $this;
  284. }
  285. public function getTelefonos(): ?string
  286. {
  287. return $this->telefonos;
  288. }
  289. public function setTelefonos(?string $telefonos): static
  290. {
  291. $this->telefonos = $telefonos;
  292. return $this;
  293. }
  294. public function getPais(): ?string
  295. {
  296. return $this->pais;
  297. }
  298. public function setPais(?string $pais): static
  299. {
  300. $this->pais = $pais;
  301. return $this;
  302. }
  303. public function isActivo(): ?bool
  304. {
  305. return $this->activo;
  306. }
  307. public function setActivo(?bool $activo): static
  308. {
  309. $this->activo = $activo;
  310. return $this;
  311. }
  312. public function getDeletedAt(): ?\DateTimeInterface
  313. {
  314. return $this->deletedAt;
  315. }
  316. public function setDeletedAt(?\DateTimeInterface $deletedAt): static
  317. {
  318. $this->deletedAt = $deletedAt;
  319. return $this;
  320. }
  321. public function getUpdatedAt(): ?\DateTimeInterface
  322. {
  323. return $this->updatedAt;
  324. }
  325. public function setUpdatedAt(\DateTimeInterface $updatedAt): static
  326. {
  327. $this->updatedAt = $updatedAt;
  328. return $this;
  329. }
  330. public function getCreatedAt(): ?\DateTimeInterface
  331. {
  332. return $this->createdAt;
  333. }
  334. public function setCreatedAt(\DateTimeInterface $createdAt): static
  335. {
  336. $this->createdAt = $createdAt;
  337. return $this;
  338. }
  339. public function __toString(): string
  340. {
  341. return $this->getRazonSocial();
  342. }
  343. public function getNss(): ?string
  344. {
  345. return $this->nss;
  346. }
  347. public function setNss(?string $nss): static
  348. {
  349. $this->nss = $nss;
  350. return $this;
  351. }
  352. public function getNombreComercial(): ?string
  353. {
  354. return $this->nombreComercial;
  355. }
  356. public function setNombreComercial(?string $nombreComercial): static
  357. {
  358. $this->nombreComercial = $nombreComercial;
  359. return $this;
  360. }
  361. public function getDescripcion(): ?string
  362. {
  363. return $this->descripcion;
  364. }
  365. public function setDescripcion(?string $descripcion): static
  366. {
  367. $this->descripcion = $descripcion;
  368. return $this;
  369. }
  370. public function getRrss(): ?array
  371. {
  372. return $this->rrss;
  373. }
  374. public function setRrss(?array $rrss): static
  375. {
  376. $this->rrss = $rrss;
  377. return $this;
  378. }
  379. public function getWeb(): ?string
  380. {
  381. return $this->web;
  382. }
  383. public function setWeb(?string $web): static
  384. {
  385. $this->web = $web;
  386. return $this;
  387. }
  388. public function isInfoPublic(): ?bool
  389. {
  390. return $this->infoPublic;
  391. }
  392. public function setInfoPublic(?bool $infoPublic): static
  393. {
  394. $this->infoPublic = $infoPublic;
  395. return $this;
  396. }
  397. public function isInfoProfilePublic(): ?bool
  398. {
  399. return $this->infoProfilePublic;
  400. }
  401. public function setInfoProfilePublic(?bool $infoProfilePublic): static
  402. {
  403. $this->infoProfilePublic = $infoProfilePublic;
  404. return $this;
  405. }
  406. public function getImagenes(): ?array
  407. {
  408. return $this->imagenes;
  409. }
  410. public function setImagenes(?array $imagenes): static
  411. {
  412. $this->imagenes = $imagenes;
  413. return $this;
  414. }
  415. public function getFoto(): ?string
  416. {
  417. return $this->foto;
  418. }
  419. public function setFoto(?string $foto): static
  420. {
  421. $this->foto = $foto;
  422. return $this;
  423. }
  424. public function getFotoFile(): ?File
  425. {
  426. return $this->fotoFile;
  427. }
  428. public function setFotoFile(?File $fotoFile): self
  429. {
  430. $this->fotoFile = $fotoFile;
  431. if ($fotoFile) {
  432. $this->setUpdatedAt(new DateTime('now'));
  433. }
  434. return $this;
  435. }
  436. public function getContactoNombre(): ?string
  437. {
  438. return $this->contactoNombre;
  439. }
  440. public function setContactoNombre(?string $contactoNombre): static
  441. {
  442. $this->contactoNombre = $contactoNombre;
  443. return $this;
  444. }
  445. public function getContactoApellidos(): ?string
  446. {
  447. return $this->contactoApellidos;
  448. }
  449. public function setContactoApellidos(?string $contactoApellidos): static
  450. {
  451. $this->contactoApellidos = $contactoApellidos;
  452. return $this;
  453. }
  454. /**
  455. * @return Collection<int, Recurso>
  456. */
  457. public function getRecursos(): Collection
  458. {
  459. return $this->recursos;
  460. }
  461. public function addRecurso(Recurso $recurso): static
  462. {
  463. if (!$this->recursos->contains($recurso)) {
  464. $this->recursos->add($recurso);
  465. $recurso->setEntidad($this);
  466. }
  467. return $this;
  468. }
  469. public function removeRecurso(Recurso $recurso): static
  470. {
  471. if ($this->recursos->removeElement($recurso)) {
  472. // set the owning side to null (unless already changed)
  473. if ($recurso->getEntidad() === $this) {
  474. $recurso->setEntidad(null);
  475. }
  476. }
  477. return $this;
  478. }
  479. }