<?php
namespace App\CasinoBundle\Entity;
use App\CmsBundle\Entity\PublishedTrait;
use App\CmsBundle\Entity\SlugTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
* SlotFeature
*
* @ORM\Table(
* name="slot_feature",
* indexes={
* @ORM\Index(name="slot_feature_published_index", columns={"published"})
* },
* uniqueConstraints={
* @ORM\UniqueConstraint(name="slot_feature_slug_uindex", columns={"slug"}),
* @ORM\UniqueConstraint(name="slot_feature_name_uindex", columns={"name"})
* }
* )
* @ORM\Entity()
* @ORM\HasLifecycleCallbacks()
* @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="one_day")
*/
class SlotFeature
{
use SlugTrait;
use LinkTrait;
use PublishedTrait;
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\ManyToMany(targetEntity="Slot", mappedBy="slotFeatures", cascade={"persist"})
*/
private $slots;
public function __construct()
{
$this->slots = new ArrayCollection();
}
public function __toString(): string
{
return $this->name;
}
public function getId(): ?int
{
return $this->id;
}
public function getName(): string
{
return $this->name;
}
public function setName(string $name): self
{
$this->name = $name;
return $this;
}
public function addSlot(Slot $slot): self
{
if (!$this->slots->contains($slot)) {
$this->slots[] = $slot;
$slot->addSlotFeature($this);
}
return $this;
}
public function removeSlot(Slot $slot): self
{
if ($this->slots->contains($slot)) {
$this->slots->removeElement($slot);
$slot->removeSlotFeature($this);
}
return $this;
}
}