src/Entity/EstadoValoracion.php line 13

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. /**
  7.  * @ORM\Entity(repositoryClass="App\Repository\EstadoValoracionRepository")
  8.  * @ORM\Table(name="estado_valoracion", schema="perseo")
  9.  */
  10. class EstadoValoracion extends EstadoAbstract
  11. {
  12.     /**
  13.      * @ORM\OneToMany(targetEntity="App\Entity\Valoracion", mappedBy="estado")
  14.      */
  15.     protected $valoraciones;
  16.     public function __construct()
  17.     {
  18.         $this->valoraciones = new ArrayCollection();
  19.     }
  20.     /**
  21.      * @return Collection|Valoracion[]
  22.      */
  23.     public function getValoraciones(): Collection
  24.     {
  25.         return $this->valoraciones;
  26.     }
  27.     public function addValoracione(Valoracion $valoracione): self
  28.     {
  29.         if (!$this->valoraciones->contains($valoracione)) {
  30.             $this->valoraciones[] = $valoracione;
  31.             $valoracione->setEstado($this);
  32.         }
  33.         return $this;
  34.     }
  35.     public function removeValoracione(Valoracion $valoracione): self
  36.     {
  37.         if ($this->valoraciones->removeElement($valoracione)) {
  38.             // set the owning side to null (unless already changed)
  39.             if ($valoracione->getEstado() === $this) {
  40.                 $valoracione->setEstado(null);
  41.             }
  42.         }
  43.         return $this;
  44.     }
  45. }