src/Entity/Slave/InterventionOutcomeType.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Slave;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\DBAL\Types\Types;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * @ORM\Table(name="eposm_s_intervention_outcome_type")
  9.  * @ORM\Entity
  10.  */
  11. class InterventionOutcomeType
  12. {    
  13.     public function __toString(){
  14.         return $this->getValue();
  15.     }
  16.     
  17.     /**
  18.      * @ORM\Column(name="id", type="bigint")
  19.      * @ORM\Id
  20.      * @ORM\GeneratedValue(strategy="AUTO")
  21.      */
  22.     protected $id;
  23.     
  24.     /**
  25.      * @ORM\Column(name="slug", type="string", length=191, unique=true)
  26.      */
  27.     protected $slug;
  28.     
  29.     /**
  30.      * @ORM\Column(name="value", type="string", length=191)
  31.      */
  32.     protected $value;
  33.     // OneToMany
  34.         /**
  35.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\InterventionOutcome", mappedBy="type")
  36.          */
  37.         private $outcomes;
  38.         
  39.         /**
  40.          * @ORM\OneToMany(targetEntity="App\Entity\Slave\Intervention", mappedBy="outcomeType")
  41.          */
  42.         private $interventions;
  43.         public function __construct()
  44.         {
  45.             $this->outcomes = new ArrayCollection();
  46.             $this->interventions = new ArrayCollection();
  47.         }
  48.     //
  49.     public function getId(): ?string
  50.     {
  51.         return $this->id;
  52.     }
  53.     public function getSlug(): ?string
  54.     {
  55.         return $this->slug;
  56.     }
  57.     public function setSlug(string $slug): static
  58.     {
  59.         $this->slug $slug;
  60.         return $this;
  61.     }
  62.     public function getValue(): ?string
  63.     {
  64.         return $this->value;
  65.     }
  66.     public function setValue(string $value): static
  67.     {
  68.         $this->value $value;
  69.         return $this;
  70.     }
  71.     /**
  72.      * @return Collection<int, InterventionOutcome>
  73.      */
  74.     public function getOutcomes(): Collection
  75.     {
  76.         return $this->outcomes;
  77.     }
  78.     public function addOutcome(InterventionOutcome $outcome): static
  79.     {
  80.         if (!$this->outcomes->contains($outcome)) {
  81.             $this->outcomes->add($outcome);
  82.             $outcome->setType($this);
  83.         }
  84.         return $this;
  85.     }
  86.     public function removeOutcome(InterventionOutcome $outcome): static
  87.     {
  88.         if ($this->outcomes->removeElement($outcome)) {
  89.             // set the owning side to null (unless already changed)
  90.             if ($outcome->getType() === $this) {
  91.                 $outcome->setType(null);
  92.             }
  93.         }
  94.         return $this;
  95.     }
  96.     /**
  97.      * @return Collection<int, Intervention>
  98.      */
  99.     public function getInterventions(): Collection
  100.     {
  101.         return $this->interventions;
  102.     }
  103.     public function addIntervention(Intervention $intervention): static
  104.     {
  105.         if (!$this->interventions->contains($intervention)) {
  106.             $this->interventions->add($intervention);
  107.             $intervention->setOutcomeType($this);
  108.         }
  109.         return $this;
  110.     }
  111.     public function removeIntervention(Intervention $intervention): static
  112.     {
  113.         if ($this->interventions->removeElement($intervention)) {
  114.             // set the owning side to null (unless already changed)
  115.             if ($intervention->getOutcomeType() === $this) {
  116.                 $intervention->setOutcomeType(null);
  117.             }
  118.         }
  119.         return $this;
  120.     }
  121. }