src/CasinoBundle/Entity/SlotTheme.php line 27

Open in your IDE?
  1. <?php
  2. namespace App\CasinoBundle\Entity;
  3. use App\CmsBundle\Entity\PublishedTrait;
  4. use App\CmsBundle\Entity\SlugTrait;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. /**
  8.  * SlotTheme
  9.  *
  10.  * @ORM\Table(
  11.  *     name="slot_theme",
  12.  *     indexes={
  13.  *         @ORM\Index(name="slot_theme_published_index", columns={"published"})
  14.  *     },
  15.  *     uniqueConstraints={
  16.  *         @ORM\UniqueConstraint(name="slot_theme_slug_uindex", columns={"slug"}),
  17.  *         @ORM\UniqueConstraint(name="slot_theme_name_uindex", columns={"name"})
  18.  *     }
  19.  * )
  20.  * @ORM\Entity()
  21.  * @ORM\HasLifecycleCallbacks()
  22.  * @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="one_day")
  23.  */
  24. class SlotTheme
  25. {
  26.     use SlugTrait;
  27.     use LinkTrait;
  28.     use PublishedTrait;
  29.     /**
  30.      * @ORM\Id()
  31.      * @ORM\GeneratedValue()
  32.      * @ORM\Column(type="integer")
  33.      */
  34.     private $id;
  35.     /**
  36.      * @ORM\Column(type="string", length=255)
  37.      */
  38.     private $name;
  39.     /**
  40.      * @ORM\ManyToMany(targetEntity="Slot", mappedBy="slotThemes", cascade={"persist"})
  41.      */
  42.     private $slots;
  43.     public function __construct()
  44.     {
  45.         $this->slots = new ArrayCollection();
  46.     }
  47.     public function __toString(): string
  48.     {
  49.         return $this->name;
  50.     }
  51.     public function getId(): ?int
  52.     {
  53.         return $this->id;
  54.     }
  55.     public function getName(): string
  56.     {
  57.         return $this->name;
  58.     }
  59.     public function setName(string $name): self
  60.     {
  61.         $this->name $name;
  62.         return $this;
  63.     }
  64.     public function addSlot(Slot $slot): self
  65.     {
  66.         if (!$this->slots->contains($slot)) {
  67.             $this->slots[] = $slot;
  68.             $slot->addSlotTheme($this);
  69.         }
  70.         return $this;
  71.     }
  72.     public function removeSlot(Slot $slot): self
  73.     {
  74.         if ($this->slots->contains($slot)) {
  75.             $this->slots->removeElement($slot);
  76.             $slot->removeSlotTheme($this);
  77.         }
  78.         return $this;
  79.     }
  80. }