<?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;
/**
* SlotTag
*
* @ORM\Table(
* name="slot_tag",
* indexes={
* @ORM\Index(name="slot_tag_published_index", columns={"published"})
* },
* uniqueConstraints={
* @ORM\UniqueConstraint(name="slot_tag_slug_uindex", columns={"slug"}),
* @ORM\UniqueConstraint(name="slot_tag_name_uindex", columns={"name"})
* }
* )
* @ORM\Entity()
* @ORM\HasLifecycleCallbacks()
* @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="one_day")
*/
class SlotTag
{
use SlugTrait;
use PublishedTrait;
/**
* @ORM\Id()
* @ORM\GeneratedValue()
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\Column(type="string", length=255)
*/
private $name;
/**
* @ORM\Column(type="integer", nullable=true)
*/
private $type;
/**
* @ORM\ManyToMany(targetEntity="Slot", mappedBy="slotTags", 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 getType(): ?int
{
return $this->type;
}
public function setType(int $type): self
{
$this->type = $type;
return $this;
}
public function addSlot(Slot $slot): self
{
if (!$this->slots->contains($slot)) {
$this->slots[] = $slot;
$slot->addSlotTag($this);
}
return $this;
}
public function removeSlot(Slot $slot): self
{
if ($this->slots->contains($slot)) {
$this->slots->removeElement($slot);
$slot->removeSlotTag($this);
}
return $this;
}
}