<?phpnamespace App\Domain\Entity;use App\Shared\Domain\ApplicationCore\Interfaces\EntityInterface;use DateTimeInterface;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;use Doctrine\DBAL\Types\Types;use Doctrine\ORM\Mapping as ORM;use Symfony\Component\Uid\Uuid;use Symfony\Component\Validator\Constraints as Assert;class Expediente implements EntityInterface{ private ?Uuid $id = null; private ?string $key = null; private ?string $nombre = null; /** * @var string|null * @Assert\NotBlank(message="not_blank") */ private ?string $numeroExpediente = null; private ?string $descripcion = null; private ?DateTimeInterface $createdAt = null; private ?DateTimeInterface $updatedAt = null; private ?DateTimeInterface $deletedAt = null; private ?EstadoExpediente $estadoExpediente = null; private ?ExpedienteCabecera $cabecera = null; /** * @var MetadataExpediente|null * @Assert\NotBlank(message="not_blank") */ private ?MetadataExpediente $metadata = null; private ?SonataUserUser $creador = null; private ?Entidad $entidad = null; private ?DocumentacionRegistro $solicitud = null; private Collection $tramites; private Collection $minutas; private Collection $responsables; private Collection $registros; public function __construct() { $this->tramites = new ArrayCollection(); $this->minutas = new ArrayCollection(); $this->responsables = new ArrayCollection(); $this->registros = new ArrayCollection(); } public function __toString(): string { return $this->getNumeroExpediente()??'X/0000/2024'; } public function getKey(): ?string { return $this->key; } public function setKey(?string $key): static { $this->key = $key; return $this; } public function getNumeroExpediente(): ?string { return $this->numeroExpediente; } public function setNumeroExpediente(?string $numeroExpediente): static { $this->numeroExpediente = $numeroExpediente; return $this; } public function getNombre(): ?string { return $this->nombre; } public function setNombre(?string $nombre): static { $this->nombre = $nombre; return $this; } public function getDescripcion(): ?string { return $this->descripcion; } public function setDescripcion(?string $descripcion): static { $this->descripcion = $descripcion; return $this; } public function getCreatedAt(): ?\DateTimeInterface { return $this->createdAt; } public function setCreatedAt(\DateTimeInterface $createdAt): static { $this->createdAt = $createdAt; return $this; } public function getUpdatedAt(): ?\DateTimeInterface { return $this->updatedAt; } public function setUpdatedAt(\DateTimeInterface $updatedAt): static { $this->updatedAt = $updatedAt; return $this; } public function getDeletedAt(): ?\DateTimeInterface { return $this->deletedAt; } public function setDeletedAt(?\DateTimeInterface $deletedAt): static { $this->deletedAt = $deletedAt; return $this; } public function getId(): ?Uuid { return $this->id; } /** * @return Collection<int, Tramite> */ public function getTramites(): Collection { return $this->tramites; } public function addTramite(Tramite $tramite): static { if (!$this->tramites->contains($tramite)) { $this->tramites->add($tramite); $tramite->setExpediente($this); } return $this; } public function removeTramite(Tramite $tramite): static { if ($this->tramites->removeElement($tramite)) { // set the owning side to null (unless already changed) if ($tramite->getExpediente() === $this) { $tramite->setExpediente(null); } } return $this; } /** * @return Collection<int, Minuta> */ public function getMinutas(): Collection { return $this->minutas; } public function addMinuta(Minuta $minuta): static { if (!$this->minutas->contains($minuta)) { $this->minutas->add($minuta); $minuta->setExpediente($this); } return $this; } public function removeMinuta(Minuta $minuta): static { if ($this->minutas->removeElement($minuta)) { // set the owning side to null (unless already changed) if ($minuta->getExpediente() === $this) { $minuta->setExpediente(null); } } return $this; } public function getEstadoExpediente(): ?EstadoExpediente { return $this->estadoExpediente; } public function setEstadoExpediente(?EstadoExpediente $estadoExpediente): static { $this->estadoExpediente = $estadoExpediente; return $this; } public function getMetadata(): ?MetadataExpediente { return $this->metadata; } public function setMetadata(?MetadataExpediente $metadata): static { $this->metadata = $metadata; return $this; } public function getCreador(): ?SonataUserUser { return $this->creador; } public function setCreador(?SonataUserUser $creador): static { $this->creador = $creador; return $this; } public function getEntidad(): ?Entidad { return $this->entidad; } public function setEntidad(?Entidad $entidad): static { $this->entidad = $entidad; return $this; } /** * @return Collection<int, SonataUserUser> */ public function getResponsables(): Collection { return $this->responsables; } public function addResponsable(SonataUserUser $responsable): static { if (!$this->responsables->contains($responsable)) { $this->responsables->add($responsable); } return $this; } public function removeResponsable(SonataUserUser $responsable): static { $this->responsables->removeElement($responsable); return $this; } public function getCabecera(): ?ExpedienteCabecera { return $this->cabecera; } public function setCabecera(?ExpedienteCabecera $cabecera): static { $this->cabecera = $cabecera; return $this; } public function getTipo(): ?string { $data = json_decode($this->getCustom(), true); switch ($data['procedimiento']) { case 'CM': case '0': $return = 'EC'; break; case 'ARBITRAJE': case '1': $return = 'A'; break; default: $return = null; break; } return $return; return 'EC / C/ M / A'; } public function getEmpresa(): ?string { $data = json_decode($this->getCustom(), true); switch ($data['entidad']) { case 'EMPRESA': case '0': $tipo = 'E'; break; case 'SECTOR': case '1': $tipo = 'S'; break; default: $tipo = '---'; break; } return $tipo; } public function getEmpresaNombre(): ?string { $data = json_decode($this->getCustom(), true); switch ($data['entidad']) { case 'EMPRESA': case '0': $id = $data['empresa']; break; case 'SECTOR': case '1': $id = $data['sector']; break; default: $id = null; break; } return $id; } /** * @return Collection<int, DocumentacionRegistro> */ public function getRegistros(): Collection { return $this->registros; } public function addRegistro(DocumentacionRegistro $registro): static { if (!$this->registros->contains($registro)) { $this->registros->add($registro); $registro->setExpediente($this); } return $this; } public function removeRegistro(DocumentacionRegistro $registro): static { if ($this->registros->removeElement($registro)) { // set the owning side to null (unless already changed) if ($registro->getExpediente() === $this) { $registro->setExpediente(null); } } return $this; } public function getFase():?string { return $this->getEstadoExpediente()?->getSubestado(); } public function getSolicitud(): ?DocumentacionRegistro { return $this->solicitud; } public function setSolicitud(?DocumentacionRegistro $solicitud): static { $this->solicitud = $solicitud; return $this; } public function getCustom():?string { return $this->getSolicitud()?->getCustom()->getForm(); }}