src/Domain/Entity/MetadataExpedienteCabecera.php line 9

Open in your IDE?
  1. <?php
  2. namespace App\Domain\Entity;
  3. use App\Shared\Domain\ApplicationCore\Interfaces\EntityInterface;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. class MetadataExpedienteCabecera extends Metadata
  7. {
  8.     private ?MetadataExpediente $metadataExpediente null;
  9.     private Collection $cabeceras;
  10.     public function __construct()
  11.     {
  12.         parent::__construct();
  13.         $this->cabeceras = new ArrayCollection();
  14.     }
  15.     public function getMetadataExpediente(): ?MetadataExpediente
  16.     {
  17.         return $this->metadataExpediente;
  18.     }
  19.     public function setMetadataExpediente(?MetadataExpediente $metadataExpediente): static
  20.     {
  21.         // unset the owning side of the relation if necessary
  22.         if ($metadataExpediente === null && $this->metadataExpediente !== null) {
  23.             $this->metadataExpediente->setMetadataCabecera(null);
  24.         }
  25.         // set the owning side of the relation if necessary
  26.         if ($metadataExpediente !== null && $metadataExpediente->getMetadataCabecera() !== $this) {
  27.             $metadataExpediente->setMetadataCabecera($this);
  28.         }
  29.         $this->metadataExpediente $metadataExpediente;
  30.         return $this;
  31.     }
  32.     /**
  33.      * @return Collection<int, ExpedienteCabecera>
  34.      */
  35.     public function getCabeceras(): Collection
  36.     {
  37.         return $this->cabeceras;
  38.     }
  39.     public function addCabecera(ExpedienteCabecera $cabecera): static
  40.     {
  41.         if (!$this->cabeceras->contains($cabecera)) {
  42.             $this->cabeceras->add($cabecera);
  43.             $cabecera->setMetadata($this);
  44.         }
  45.         return $this;
  46.     }
  47.     public function removeCabecera(ExpedienteCabecera $cabecera): static
  48.     {
  49.         if ($this->cabeceras->removeElement($cabecera)) {
  50.             // set the owning side to null (unless already changed)
  51.             if ($cabecera->getMetadata() === $this) {
  52.                 $cabecera->setMetadata(null);
  53.             }
  54.         }
  55.         return $this;
  56.     }
  57. }