src/Entity/TipoCargoMejora.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\TipoCargoMejoraRepository")
  9.  * @ORM\Table(name="tipo_cargo_mejora", schema="perseo")
  10.  * @Gedmo\SoftDeleteable(fieldName="deletedAt", timeAware=false, hardDelete=true)
  11.  */
  12. class TipoCargoMejora extends TipoCargoAbstract
  13. {
  14.     /**
  15.      * @ORM\OneToMany(targetEntity="App\Entity\AccionMejora", mappedBy="tipo")
  16.      */
  17.     private $accionesMejora;
  18.     public function __construct()
  19.     {
  20.         parent::__construct();
  21.         $this->accionesMejora = new ArrayCollection();
  22.     }
  23.     /**
  24.      * @return Collection<int, AccionMejora>
  25.      */
  26.     public function getAccionesMejora(): Collection
  27.     {
  28.         return $this->accionesMejora;
  29.     }
  30.     public function addAccionesMejora(AccionMejora $accionesMejora): self
  31.     {
  32.         if (!$this->accionesMejora->contains($accionesMejora)) {
  33.             $this->accionesMejora->add($accionesMejora);
  34.             $accionesMejora->setTipo($this);
  35.         }
  36.         return $this;
  37.     }
  38.     public function removeAccionesMejora(AccionMejora $accionesMejora): self
  39.     {
  40.         if ($this->accionesMejora->removeElement($accionesMejora)) {
  41.             // set the owning side to null (unless already changed)
  42.             if ($accionesMejora->getTipo() === $this) {
  43.                 $accionesMejora->setTipo(null);
  44.             }
  45.         }
  46.         return $this;
  47.     }
  48. }