<?phpnamespace App\Entity;use App\Entity\AbstractOption;use Doctrine\ORM\Mapping as ORM;use App\Entity\Trait\TranslatableLocale;use App\Repository\OptionSelectRepository;use Doctrine\Common\Collections\Collection;use Doctrine\Common\Collections\ArrayCollection;use Gedmo\Translatable\Translatable;use Gedmo\Mapping\Annotation as Gedmo;/** * @ORM\Entity(repositoryClass=OptionSelectRepository::class) */class OptionSelect extends AbstractOption{ use TranslatableLocale; /** * @ORM\OneToMany(targetEntity=OptionSelectItem::class, mappedBy="optionSelect", orphanRemoval=true, cascade={"persist"}) */ private $optionSelectItems; /** * @ORM\ManyToOne(targetEntity=Extra::class, inversedBy="optionSelects") * @ORM\JoinColumn(nullable=false) */ private $extra; /** * @ORM\OneToMany(targetEntity=OptionSelectReservation::class, mappedBy="optionSelect") */ private $optionSelectReservations; public function __construct() { $this->optionSelectItems = new ArrayCollection(); $this->optionSelectReservations = new ArrayCollection(); } /** * @return Collection<int, OptionSelectItem> */ public function getOptionSelectItems(): Collection { return $this->optionSelectItems; } public function addOptionSelectItem(OptionSelectItem $optionSelectItem): self { if (!$this->optionSelectItems->contains($optionSelectItem)) { $this->optionSelectItems[] = $optionSelectItem; $optionSelectItem->setOptionSelect($this); } return $this; } public function removeOptionSelectItem(OptionSelectItem $optionSelectItem): self { if ($this->optionSelectItems->removeElement($optionSelectItem)) { // set the owning side to null (unless already changed) if ($optionSelectItem->getOptionSelect() === $this) { $optionSelectItem->setOptionSelect(null); } } return $this; } public function getExtra(): ?Extra { return $this->extra; } public function setExtra(?Extra $extra): self { $this->extra = $extra; return $this; } /** * @return Collection<int, OptionSelectReservation> */ public function getOptionSelectReservations(): Collection { return $this->optionSelectReservations; } public function addOptionSelectReservation(OptionSelectReservation $optionSelectReservation): self { if (!$this->optionSelectReservations->contains($optionSelectReservation)) { $this->optionSelectReservations[] = $optionSelectReservation; $optionSelectReservation->setOptionSelect($this); } return $this; } public function removeOptionSelectReservation(OptionSelectReservation $optionSelectReservation): self { if ($this->optionSelectReservations->removeElement($optionSelectReservation)) { // set the owning side to null (unless already changed) if ($optionSelectReservation->getOptionSelect() === $this) { $optionSelectReservation->setOptionSelect(null); } } return $this; } public function getEntitiesToRefresh(): array { $entitiesToRefresh = []; $entitiesToRefresh[] = $this; foreach($this->getOptionSelectItems() as $optionSelectItem) { $entitiesToRefresh = array_merge($entitiesToRefresh, $optionSelectItem->getEntitiesToRefresh()); } return $entitiesToRefresh; }}