src/Domain/Entity/Expediente.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Domain\Entity;
  3. use App\Shared\Domain\ApplicationCore\Interfaces\EntityInterface;
  4. use DateTimeInterface;
  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 Expediente implements EntityInterface
  12. {
  13.     private ?Uuid $id null;
  14.     private ?string $key null;
  15.     private ?string $nombre null;
  16.     /**
  17.      * @var string|null
  18.      * @Assert\NotBlank(message="not_blank")
  19.      */
  20.     private ?string $numeroExpediente null;
  21.     private ?string $descripcion null;
  22.     private ?DateTimeInterface $createdAt null;
  23.     private ?DateTimeInterface $updatedAt null;
  24.     private ?DateTimeInterface $deletedAt null;
  25.     private ?EstadoExpediente $estadoExpediente null;
  26.     private ?ExpedienteCabecera $cabecera null;
  27.     /**
  28.      * @var MetadataExpediente|null
  29.      * @Assert\NotBlank(message="not_blank")
  30.      */
  31.     private ?MetadataExpediente $metadata null;
  32.     private ?SonataUserUser $creador null;
  33.     private ?Entidad $entidad null;
  34.     private ?DocumentacionRegistro $solicitud null;
  35.     private Collection $tramites;
  36.     private Collection $minutas;
  37.     private Collection $responsables;
  38.     private Collection $registros;
  39.     public function __construct()
  40.     {
  41.         $this->tramites = new ArrayCollection();
  42.         $this->minutas = new ArrayCollection();
  43.         $this->responsables = new ArrayCollection();
  44.         $this->registros = new ArrayCollection();
  45.     }
  46.     public function __toString(): string
  47.     {
  48.         return $this->getNumeroExpediente()??'X/0000/2024';
  49.     }
  50.     public function getKey(): ?string
  51.     {
  52.         return $this->key;
  53.     }
  54.     public function setKey(?string $key): static
  55.     {
  56.         $this->key $key;
  57.         return $this;
  58.     }
  59.     public function getNumeroExpediente(): ?string
  60.     {
  61.         return $this->numeroExpediente;
  62.     }
  63.     public function setNumeroExpediente(?string $numeroExpediente): static
  64.     {
  65.         $this->numeroExpediente $numeroExpediente;
  66.         return $this;
  67.     }
  68.     public function getNombre(): ?string
  69.     {
  70.         return $this->nombre;
  71.     }
  72.     public function setNombre(?string $nombre): static
  73.     {
  74.         $this->nombre $nombre;
  75.         return $this;
  76.     }
  77.     public function getDescripcion(): ?string
  78.     {
  79.         return $this->descripcion;
  80.     }
  81.     public function setDescripcion(?string $descripcion): static
  82.     {
  83.         $this->descripcion $descripcion;
  84.         return $this;
  85.     }
  86.     public function getCreatedAt(): ?\DateTimeInterface
  87.     {
  88.         return $this->createdAt;
  89.     }
  90.     public function setCreatedAt(\DateTimeInterface $createdAt): static
  91.     {
  92.         $this->createdAt $createdAt;
  93.         return $this;
  94.     }
  95.     public function getUpdatedAt(): ?\DateTimeInterface
  96.     {
  97.         return $this->updatedAt;
  98.     }
  99.     public function setUpdatedAt(\DateTimeInterface $updatedAt): static
  100.     {
  101.         $this->updatedAt $updatedAt;
  102.         return $this;
  103.     }
  104.     public function getDeletedAt(): ?\DateTimeInterface
  105.     {
  106.         return $this->deletedAt;
  107.     }
  108.     public function setDeletedAt(?\DateTimeInterface $deletedAt): static
  109.     {
  110.         $this->deletedAt $deletedAt;
  111.         return $this;
  112.     }
  113.     public function getId(): ?Uuid
  114.     {
  115.         return $this->id;
  116.     }
  117.     /**
  118.      * @return Collection<int, Tramite>
  119.      */
  120.     public function getTramites(): Collection
  121.     {
  122.         return $this->tramites;
  123.     }
  124.     public function addTramite(Tramite $tramite): static
  125.     {
  126.         if (!$this->tramites->contains($tramite)) {
  127.             $this->tramites->add($tramite);
  128.             $tramite->setExpediente($this);
  129.         }
  130.         return $this;
  131.     }
  132.     public function removeTramite(Tramite $tramite): static
  133.     {
  134.         if ($this->tramites->removeElement($tramite)) {
  135.             // set the owning side to null (unless already changed)
  136.             if ($tramite->getExpediente() === $this) {
  137.                 $tramite->setExpediente(null);
  138.             }
  139.         }
  140.         return $this;
  141.     }
  142.     /**
  143.      * @return Collection<int, Minuta>
  144.      */
  145.     public function getMinutas(): Collection
  146.     {
  147.         return $this->minutas;
  148.     }
  149.     public function addMinuta(Minuta $minuta): static
  150.     {
  151.         if (!$this->minutas->contains($minuta)) {
  152.             $this->minutas->add($minuta);
  153.             $minuta->setExpediente($this);
  154.         }
  155.         return $this;
  156.     }
  157.     public function removeMinuta(Minuta $minuta): static
  158.     {
  159.         if ($this->minutas->removeElement($minuta)) {
  160.             // set the owning side to null (unless already changed)
  161.             if ($minuta->getExpediente() === $this) {
  162.                 $minuta->setExpediente(null);
  163.             }
  164.         }
  165.         return $this;
  166.     }
  167.     public function getEstadoExpediente(): ?EstadoExpediente
  168.     {
  169.         return $this->estadoExpediente;
  170.     }
  171.     public function setEstadoExpediente(?EstadoExpediente $estadoExpediente): static
  172.     {
  173.         $this->estadoExpediente $estadoExpediente;
  174.         return $this;
  175.     }
  176.     public function getMetadata(): ?MetadataExpediente
  177.     {
  178.         return $this->metadata;
  179.     }
  180.     public function setMetadata(?MetadataExpediente $metadata): static
  181.     {
  182.         $this->metadata $metadata;
  183.         return $this;
  184.     }
  185.     public function getCreador(): ?SonataUserUser
  186.     {
  187.         return $this->creador;
  188.     }
  189.     public function setCreador(?SonataUserUser $creador): static
  190.     {
  191.         $this->creador $creador;
  192.         return $this;
  193.     }
  194.     public function getEntidad(): ?Entidad
  195.     {
  196.         return $this->entidad;
  197.     }
  198.     public function setEntidad(?Entidad $entidad): static
  199.     {
  200.         $this->entidad $entidad;
  201.         return $this;
  202.     }
  203.     /**
  204.      * @return Collection<int, SonataUserUser>
  205.      */
  206.     public function getResponsables(): Collection
  207.     {
  208.         return $this->responsables;
  209.     }
  210.     public function addResponsable(SonataUserUser $responsable): static
  211.     {
  212.         if (!$this->responsables->contains($responsable)) {
  213.             $this->responsables->add($responsable);
  214.         }
  215.         return $this;
  216.     }
  217.     public function removeResponsable(SonataUserUser $responsable): static
  218.     {
  219.         $this->responsables->removeElement($responsable);
  220.         return $this;
  221.     }
  222.     public function getCabecera(): ?ExpedienteCabecera
  223.     {
  224.         return $this->cabecera;
  225.     }
  226.     public function setCabecera(?ExpedienteCabecera $cabecera): static
  227.     {
  228.         $this->cabecera $cabecera;
  229.         return $this;
  230.     }
  231.     public function getTipo(): ?string
  232.     {
  233.         $data json_decode($this->getCustom(), true);
  234.         switch ($data['procedimiento'])
  235.         {
  236.             case 'CM':
  237.             case '0':
  238.                  $return 'EC';
  239.                 break;
  240.             case 'ARBITRAJE':
  241.             case '1':
  242.                 $return 'A';
  243.                 break;
  244.             default:
  245.                 $return null;
  246.                 break;
  247.         }
  248.         return $return;
  249.         return 'EC / C/ M / A';
  250.     }
  251.     public function getEmpresa(): ?string
  252.     {
  253.         $data json_decode($this->getCustom(), true);
  254.         switch ($data['entidad'])
  255.         {
  256.             case 'EMPRESA':
  257.             case '0':
  258.                 $tipo 'E';
  259.                 break;
  260.             case 'SECTOR':
  261.             case '1':
  262.                 $tipo 'S';
  263.                 break;
  264.             default:
  265.                 $tipo '---';
  266.                 break;
  267.         }
  268.         return $tipo;
  269.     }
  270.     public function getEmpresaNombre(): ?string
  271.     {
  272.         $data json_decode($this->getCustom(), true);
  273.         switch ($data['entidad'])
  274.         {
  275.             case 'EMPRESA':
  276.             case '0':
  277.                 $id $data['empresa'];
  278.                 break;
  279.             case 'SECTOR':
  280.             case '1':
  281.                 $id $data['sector'];
  282.                 break;
  283.             default:
  284.                 $id null;
  285.                 break;
  286.         }
  287.         return $id;
  288.     }
  289.     /**
  290.      * @return Collection<int, DocumentacionRegistro>
  291.      */
  292.     public function getRegistros(): Collection
  293.     {
  294.         return $this->registros;
  295.     }
  296.     public function addRegistro(DocumentacionRegistro $registro): static
  297.     {
  298.         if (!$this->registros->contains($registro)) {
  299.             $this->registros->add($registro);
  300.             $registro->setExpediente($this);
  301.         }
  302.         return $this;
  303.     }
  304.     public function removeRegistro(DocumentacionRegistro $registro): static
  305.     {
  306.         if ($this->registros->removeElement($registro)) {
  307.             // set the owning side to null (unless already changed)
  308.             if ($registro->getExpediente() === $this) {
  309.                 $registro->setExpediente(null);
  310.             }
  311.         }
  312.         return $this;
  313.     }
  314.     public function getFase():?string
  315.     {
  316.         return $this->getEstadoExpediente()?->getSubestado();
  317.     }
  318.     public function getSolicitud(): ?DocumentacionRegistro
  319.     {
  320.         return $this->solicitud;
  321.     }
  322.     public function setSolicitud(?DocumentacionRegistro $solicitud): static
  323.     {
  324.         $this->solicitud $solicitud;
  325.         return $this;
  326.     }
  327.     public function getCustom():?string
  328.     {
  329.         return $this->getSolicitud()?->getCustom()->getForm();
  330.     }
  331. }