src/Domain/Entity/ConsortiumLaboral.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Domain\Entity;
  3. use App\Domain\Interfaces\IntervinienteInterface;
  4. use App\Shared\Domain\Validator as CRLAssert;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use Doctrine\DBAL\Types\Types;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Symfony\Component\Uid\Uuid;
  10. use Symfony\Component\Validator\Constraints as Assert;
  11. class ConsortiumLaboral implements IntervinienteInterface
  12. {
  13.     /**
  14.      * @var string|null
  15.      * @Assert\Length( max=9, maxMessage="max_length {{ limit }}")
  16.      * @CRLAssert\ConstraintCIF()
  17.      */
  18.     private ?string $cif null;
  19.     /**
  20.      * @var string|null
  21.      * @Assert\NotBlank(message="not_blank")
  22.      */
  23.     private ?string $razonSocial null;
  24.     private ?string $descripcion null;
  25.     /**
  26.      * @var string|null
  27.      * @Assert\NotBlank(message="not_blank")
  28.      */
  29.     private ?string $direccion null;
  30.     /**
  31.      * @var string|null
  32.      * @Assert\NotBlank(message="not_blank")
  33.      */
  34.     private ?string $cp null;
  35.     /**
  36.      * @var string|null
  37.      * @Assert\NotBlank(message="not_blank")
  38.      * @Assert\Regex(
  39.      *     pattern="/^[0-9]+$/",
  40.      *     match=true,
  41.      *     message="The value {{ value }} is not a valid phone number"
  42.      * )
  43.      */
  44.     private ?string $telefono null;
  45.     /**
  46.      * @var string|null
  47.      * @Assert\Email(message="is_not_valid")
  48.      */
  49.     private ?string $email null;
  50.     private ?bool $active;
  51.     private ?\DateTimeInterface $createdAt null;
  52.     private ?\DateTimeInterface $updatedAt null;
  53.     private ?\DateTimeInterface $deletedAt null;
  54.     private ?Uuid $id null;
  55.     /**
  56.      * @var Municipio|null
  57.      * @Assert\NotBlank(message="not_blank")
  58.      */
  59.     private ?Municipio $municipio null;
  60.     /**
  61.      * @var Provincia|null
  62.      * @Assert\NotBlank(message="not_blank")
  63.      */
  64.     private ?Provincia $provincia null;
  65.     private ?Persona $personaContacto null;
  66.     private $personas;
  67.     public function __construct()
  68.     {
  69.         $this->personas = new ArrayCollection();
  70.         $this->active true;
  71.     }
  72.     public function __toString(): string
  73.     {
  74.         return $this->getRazonSocial() ?? '---';
  75.     }
  76.     public function getCif(): ?string
  77.     {
  78.         return $this->cif;
  79.     }
  80.     public function setCif(?string $cif): static
  81.     {
  82.         $this->cif $cif;
  83.         return $this;
  84.     }
  85.     public function getRazonSocial(): ?string
  86.     {
  87.         return $this->razonSocial;
  88.     }
  89.     public function setRazonSocial(?string $razonSocial): static
  90.     {
  91.         $this->razonSocial $razonSocial;
  92.         return $this;
  93.     }
  94.     public function getDescripcion(): ?string
  95.     {
  96.         return $this->descripcion;
  97.     }
  98.     public function setDescripcion(?string $descripcion): static
  99.     {
  100.         $this->descripcion $descripcion;
  101.         return $this;
  102.     }
  103.     public function getDireccion(): ?string
  104.     {
  105.         return $this->direccion;
  106.     }
  107.     public function setDireccion(?string $direccion): static
  108.     {
  109.         $this->direccion $direccion;
  110.         return $this;
  111.     }
  112.     public function getCp(): ?string
  113.     {
  114.         return $this->cp;
  115.     }
  116.     public function setCp(?string $cp): static
  117.     {
  118.         $this->cp $cp;
  119.         return $this;
  120.     }
  121.     public function getTelefono(): ?string
  122.     {
  123.         return $this->telefono;
  124.     }
  125.     public function setTelefono(?string $telefono): static
  126.     {
  127.         $this->telefono $telefono;
  128.         return $this;
  129.     }
  130.     public function getEmail(): ?string
  131.     {
  132.         return $this->email;
  133.     }
  134.     public function setEmail(?string $email): static
  135.     {
  136.         $this->email $email;
  137.         return $this;
  138.     }
  139.     public function isActive(): ?bool
  140.     {
  141.         return $this->active;
  142.     }
  143.     public function setActive(?bool $active): static
  144.     {
  145.         $this->active $active;
  146.         return $this;
  147.     }
  148.     public function getCreatedAt(): ?\DateTimeInterface
  149.     {
  150.         return $this->createdAt;
  151.     }
  152.     public function setCreatedAt(\DateTimeInterface $createdAt): static
  153.     {
  154.         $this->createdAt $createdAt;
  155.         return $this;
  156.     }
  157.     public function getUpdatedAt(): ?\DateTimeInterface
  158.     {
  159.         return $this->updatedAt;
  160.     }
  161.     public function setUpdatedAt(\DateTimeInterface $updatedAt): static
  162.     {
  163.         $this->updatedAt $updatedAt;
  164.         return $this;
  165.     }
  166.     public function getDeletedAt(): ?\DateTimeInterface
  167.     {
  168.         return $this->deletedAt;
  169.     }
  170.     public function setDeletedAt(?\DateTimeInterface $deletedAt): static
  171.     {
  172.         $this->deletedAt $deletedAt;
  173.         return $this;
  174.     }
  175.     public function getId(): ?Uuid
  176.     {
  177.         return $this->id;
  178.     }
  179.     public function getMunicipio(): ?Municipio
  180.     {
  181.         return $this->municipio;
  182.     }
  183.     public function setMunicipio(?Municipio $municipio): static
  184.     {
  185.         $this->municipio $municipio;
  186.         return $this;
  187.     }
  188.     public function getProvincia(): ?Provincia
  189.     {
  190.         return $this->provincia;
  191.     }
  192.     public function setProvincia(?Provincia $provincia): static
  193.     {
  194.         $this->provincia $provincia;
  195.         return $this;
  196.     }
  197.     public function getPersonaContacto(): ?Persona
  198.     {
  199.         return $this->personaContacto;
  200.     }
  201.     public function setPersonaContacto(?Persona $persona): static
  202.     {
  203.         $this->personaContacto $persona;
  204.         return $this;
  205.     }
  206.     public function getPersonasContacto():Collection
  207.     {
  208.         $personas = new ArrayCollection();
  209.         if($this->getPersonaContacto()) {
  210.             $personas->add($this->getPersonaContacto());
  211.         }
  212.         return $personas;
  213.     }
  214.     /**
  215.      * @return Collection<int, Persona>
  216.      */
  217.     public function getPersonas(): ?Collection
  218.     {
  219.         return $this->personas;
  220.     }
  221.     public function addPersona(Persona $persona): static
  222.     {
  223.         if (!$this->personas->contains($persona)) {
  224.             $this->personas->add($persona);
  225.         }
  226.         return $this;
  227.     }
  228.     public function removePersona(Persona $persona): static
  229.     {
  230.         $this->personas->removeElement($persona);
  231.         return $this;
  232.     }
  233.     public function getContactos(): Collection
  234.     {
  235.         return $this->getPersonas() ?? new ArrayCollection([]);
  236.     }
  237. }