src/Entity/Scenario.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ScenarioRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Validator\Constraints as Assert;
  8. /**
  9.  * @ORM\Entity(repositoryClass=ScenarioRepository::class)
  10.  */
  11. class Scenario
  12. {
  13.     /**
  14.      * @ORM\Id()
  15.      * @ORM\GeneratedValue()
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\Column(type="string", length=255, nullable=true)
  21.      */
  22.     private $description;
  23.     /**
  24.      * @ORM\OneToMany(targetEntity=Bouton::class, mappedBy="scenario", orphanRemoval=true)
  25.      */
  26.     private $boutons;
  27.     /**
  28.      * @ORM\Column(type="string", length=255)
  29.      */
  30.     private $libelle;
  31.     /**
  32.      * @ORM\ManyToOne(targetEntity=Modele::class, inversedBy="scenarios")
  33.      */
  34.     private $modele;
  35.     /**
  36.      * @ORM\OneToMany(targetEntity=Device::class, mappedBy="scenario")
  37.      */
  38.     private $devices;
  39.     public function __construct()
  40.     {
  41.         $this->boutons = new ArrayCollection();
  42.         $this->devices = new ArrayCollection();
  43.     }
  44.     public function getId(): ?int
  45.     {
  46.         return $this->id;
  47.     }
  48.     public function getDescription(): ?string
  49.     {
  50.         return $this->description;
  51.     }
  52.     public function setDescription(?string $description): self
  53.     {
  54.         $this->description $description;
  55.         return $this;
  56.     }
  57.     /**
  58.      * @return Collection|Bouton[]
  59.      */
  60.     public function getBoutons(): Collection
  61.     {
  62.         return $this->boutons;
  63.     }
  64.     public function addBouton(Bouton $bouton): self
  65.     {
  66.         if (!$this->boutons->contains($bouton)) {
  67.             $this->boutons[] = $bouton;
  68.             $bouton->setScenario($this);
  69.         }
  70.         return $this;
  71.     }
  72.     public function removeBouton(Bouton $bouton): self
  73.     {
  74.         if ($this->boutons->contains($bouton)) {
  75.             $this->boutons->removeElement($bouton);
  76.             // set the owning side to null (unless already changed)
  77.             if ($bouton->getScenario() === $this) {
  78.                 $bouton->setScenario(null);
  79.             }
  80.         }
  81.         return $this;
  82.     }
  83.     public function getLibelle(): ?string
  84.     {
  85.         return $this->libelle;
  86.     }
  87.     public function setLibelle(string $libelle): self
  88.     {
  89.         $this->libelle $libelle;
  90.         return $this;
  91.     }
  92.     public function getModele(): ?Modele
  93.     {
  94.         return $this->modele;
  95.     }
  96.     public function setModele(?Modele $modele): self
  97.     {
  98.         $this->modele $modele;
  99.         return $this;
  100.     }
  101.     /**
  102.      * @return Collection|Device[]
  103.      */
  104.     public function getDevices(): Collection
  105.     {
  106.         return $this->devices;
  107.     }
  108.     public function addDevice(Device $device): self
  109.     {
  110.         if (!$this->devices->contains($device)) {
  111.             $this->devices[] = $device;
  112.             $device->setScenario($this);
  113.         }
  114.         return $this;
  115.     }
  116.     public function removeDevice(Device $device): self
  117.     {
  118.         if ($this->devices->contains($device)) {
  119.             $this->devices->removeElement($device);
  120.             // set the owning side to null (unless already changed)
  121.             if ($device->getScenario() === $this) {
  122.                 $device->setScenario(null);
  123.             }
  124.         }
  125.         return $this;
  126.     }
  127. }