src/CasinoBundle/Entity/CasinoType.php line 14

Open in your IDE?
  1. <?php
  2. namespace App\CasinoBundle\Entity;
  3. use Doctrine\Common\Collections\ArrayCollection;
  4. use Doctrine\Common\Collections\Collection;
  5. use Doctrine\ORM\Mapping as ORM;
  6. /**
  7.  * CasinoType
  8.  *
  9.  * @ORM\Table(name="casino_type", uniqueConstraints={@ORM\UniqueConstraint(name="name_UNIQUE", columns={"name"})})
  10.  * @ORM\Entity(repositoryClass="App\CasinoBundle\Repository\CasinoTypeRepository")
  11.  */
  12. class CasinoType
  13. {
  14.     /**
  15.      * @var int
  16.      *
  17.      * @ORM\Column(name="id", type="integer", nullable=false)
  18.      * @ORM\Id
  19.      * @ORM\GeneratedValue(strategy="IDENTITY")
  20.      */
  21.     private $id;
  22.     /**
  23.      * @var string
  24.      *
  25.      * @ORM\Column(name="name", type="string", length=255, nullable=false)
  26.      */
  27.     private $name;
  28.     /**
  29.      * @ORM\ManyToMany(targetEntity="App\CasinoBundle\Entity\Casino", mappedBy="casinoTypes")
  30.      */
  31.     private $casinos;
  32.     public function __construct()
  33.     {
  34.         $this->casinos = new ArrayCollection();
  35.     }
  36.     public function __toString(): string
  37.     {
  38.         return $this->name;
  39.     }
  40.     /**
  41.      * @return int
  42.      */
  43.     public function getId(): int
  44.     {
  45.         return $this->id;
  46.     }
  47.     /**
  48.      * @param int $id
  49.      */
  50.     public function setId(int $id): void
  51.     {
  52.         $this->id $id;
  53.     }
  54.     /**
  55.      * @return string
  56.      */
  57.     public function getName(): string
  58.     {
  59.         return $this->name;
  60.     }
  61.     /**
  62.      * @param string $name
  63.      */
  64.     public function setName(string $name): void
  65.     {
  66.         $this->name $name;
  67.     }
  68.     /**
  69.      * @return Collection|Casino[]
  70.      */
  71.     public function getCasinos(): Collection
  72.     {
  73.         return $this->casinos;
  74.     }
  75.     public function addCasino(Casino $casino): self
  76.     {
  77.         if (!$this->casinos->contains($casino)) {
  78.             $this->casinos[] = $casino;
  79.             $casino->addCasinoType($this);
  80.         }
  81.         return $this;
  82.     }
  83.     public function removeCasino(Casino $casino): self
  84.     {
  85.         if ($this->casinos->contains($casino)) {
  86.             $this->casinos->removeElement($casino);
  87.             $casino->removeCasinoType($this);
  88.         }
  89.         return $this;
  90.     }
  91. }