<?php
namespace App\Entity;
use App\Repository\ScenarioRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Symfony\Component\Validator\Constraints as Assert;
/**
* @ORM\Entity(repositoryClass=ScenarioRepository::class)
*/
class Scenario
{
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255, nullable=true)
*/
private $description;
/**
* @ORM\OneToMany(targetEntity=Bouton::class, mappedBy="scenario", orphanRemoval=true)
*/
private $boutons;
/**
* @ORM\Column(type="string", length=255)
*/
private $libelle;
/**
* @ORM\ManyToOne(targetEntity=Modele::class, inversedBy="scenarios")
*/
private $modele;
/**
* @ORM\OneToMany(targetEntity=Device::class, mappedBy="scenario")
*/
private $devices;
public function __construct()
{
$this->boutons = new ArrayCollection();
$this->devices = new ArrayCollection();
}
public function getId(): ?int
{
return $this->id;
}
public function getDescription(): ?string
{
return $this->description;
}
public function setDescription(?string $description): self
{
$this->description = $description;
return $this;
}
/**
* @return Collection|Bouton[]
*/
public function getBoutons(): Collection
{
return $this->boutons;
}
public function addBouton(Bouton $bouton): self
{
if (!$this->boutons->contains($bouton)) {
$this->boutons[] = $bouton;
$bouton->setScenario($this);
}
return $this;
}
public function removeBouton(Bouton $bouton): self
{
if ($this->boutons->contains($bouton)) {
$this->boutons->removeElement($bouton);
// set the owning side to null (unless already changed)
if ($bouton->getScenario() === $this) {
$bouton->setScenario(null);
}
}
return $this;
}
public function getLibelle(): ?string
{
return $this->libelle;
}
public function setLibelle(string $libelle): self
{
$this->libelle = $libelle;
return $this;
}
public function getModele(): ?Modele
{
return $this->modele;
}
public function setModele(?Modele $modele): self
{
$this->modele = $modele;
return $this;
}
/**
* @return Collection|Device[]
*/
public function getDevices(): Collection
{
return $this->devices;
}
public function addDevice(Device $device): self
{
if (!$this->devices->contains($device)) {
$this->devices[] = $device;
$device->setScenario($this);
}
return $this;
}
public function removeDevice(Device $device): self
{
if ($this->devices->contains($device)) {
$this->devices->removeElement($device);
// set the owning side to null (unless already changed)
if ($device->getScenario() === $this) {
$device->setScenario(null);
}
}
return $this;
}
}