src/Entity/TipoCargoServicio.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. use Gedmo\Mapping\Annotation as Gedmo;
  7. /**
  8.  * @ORM\Entity(repositoryClass="App\Repository\TipoCargoServicioRepository")
  9.  * @ORM\Table(name="tipo_cargo_servicio", schema="perseo")
  10.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
  11.  */
  12. class TipoCargoServicio extends TipoCargoAbstract
  13. {
  14.     /**
  15.      * @ORM\OneToMany(targetEntity="App\Entity\AccionServicio", mappedBy="tipo")
  16.      */
  17.     private $accionesServicio;
  18.     public function __construct()
  19.     {
  20.         parent::__construct();
  21.         $this->accionesServicio = new ArrayCollection();
  22.     }
  23.     /**
  24.      * @return Collection<int, AccionServicio>
  25.      */
  26.     public function getAccionesServicio(): Collection
  27.     {
  28.         return $this->accionesServicio;
  29.     }
  30.     public function addAccionesServicio(AccionServicio $accionesServicio): self
  31.     {
  32.         if (!$this->accionesServicio->contains($accionesServicio)) {
  33.             $this->accionesServicio->add($accionesServicio);
  34.             $accionesServicio->setTipo($this);
  35.         }
  36.         return $this;
  37.     }
  38.     public function removeAccionesServicio(AccionServicio $accionesServicio): self
  39.     {
  40.         if ($this->accionesServicio->removeElement($accionesServicio)) {
  41.             // set the owning side to null (unless already changed)
  42.             if ($accionesServicio->getTipo() === $this) {
  43.                 $accionesServicio->setTipo(null);
  44.             }
  45.         }
  46.         return $this;
  47.     }
  48. }