src/CasinoBundle/Entity/SlotDevice.php line 18

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