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.         public function getId(): ?string
  49.         {
  50.             return $this->id;
  51.         }
  52.         public function getSlug(): ?string
  53.         {
  54.             return $this->slug;
  55.         }
  56.         public function setSlug(string $slug): static
  57.         {
  58.             $this->slug $slug;
  59.             return $this;
  60.         }
  61.         public function getValue(): ?string
  62.         {
  63.             return $this->value;
  64.         }
  65.         public function setValue(string $value): static
  66.         {
  67.             $this->value $value;
  68.             return $this;
  69.         }
  70.         /**
  71.          * @return Collection<int, InterventionOutcome>
  72.          */
  73.         public function getOutcomes(): Collection
  74.         {
  75.             return $this->outcomes;
  76.         }
  77.         public function addOutcome(InterventionOutcome $outcome): static
  78.         {
  79.             if (!$this->outcomes->contains($outcome)) {
  80.                 $this->outcomes->add($outcome);
  81.                 $outcome->setType($this);
  82.             }
  83.             return $this;
  84.         }
  85.         public function removeOutcome(InterventionOutcome $outcome): static
  86.         {
  87.             if ($this->outcomes->removeElement($outcome)) {
  88.                 // set the owning side to null (unless already changed)
  89.                 if ($outcome->getType() === $this) {
  90.                     $outcome->setType(null);
  91.                 }
  92.             }
  93.             return $this;
  94.         }
  95.         /**
  96.          * @return Collection<int, Intervention>
  97.          */
  98.         public function getInterventions(): Collection
  99.         {
  100.             return $this->interventions;
  101.         }
  102.         public function addIntervention(Intervention $intervention): static
  103.         {
  104.             if (!$this->interventions->contains($intervention)) {
  105.                 $this->interventions->add($intervention);
  106.                 $intervention->setOutcomeType($this);
  107.             }
  108.             return $this;
  109.         }
  110.         public function removeIntervention(Intervention $intervention): static
  111.         {
  112.             if ($this->interventions->removeElement($intervention)) {
  113.                 // set the owning side to null (unless already changed)
  114.                 if ($intervention->getOutcomeType() === $this) {
  115.                     $intervention->setOutcomeType(null);
  116.                 }
  117.             }
  118.             return $this;
  119.         }
  120. }