<?php
namespace App\CasinoBundle\Entity;
use App\CmsBundle\Entity\SlugTrait;
use App\CmsBundle\Entity\IdTrait;
use App\CmsBundle\Entity\PublishedTrait;
use App\CmsBundle\Entity\TimeStampedTrait;
use Doctrine\Common\Collections\Collection;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\ORM\Mapping as ORM;
/**
* @ORM\Table(
* name="sport_type",
* indexes={
* @ORM\Index(name="sport_type_published_index", columns={"published"}),
* },
* uniqueConstraints={
* @ORM\UniqueConstraint(name="sport_type_slug_uindex", columns={"slug"})
* }
* )
* @ORM\Entity(
* repositoryClass="App\CasinoBundle\Repository\SportTypeRepository"
* )
*/
class SportType
{
use IdTrait,
NameTrait,
SlugTrait,
PublishedTrait,
TimeStampedTrait;
/**
* @ORM\ManyToMany(
* targetEntity="App\CasinoBundle\Entity\NewBonus",
* mappedBy="sportTypes",
* fetch="EXTRA_LAZY"
* )
*/
private Collection $newBonuses;
/**
* @return string
*/
public function __toString(): string
{
return $this->getName();
}
public function __construct()
{
$this->newBonuses = new ArrayCollection();
}
/**
* @return Collection
*/
public function getNewBonuses(): Collection
{
return $this->newBonuses;
}
/**
* @param NewBonus $bonus
* @return $this
*/
public function addNewBonus(NewBonus $bonus): self
{
if (!$this->newBonuses->contains($bonus)) {
$this->newBonuses[] = $bonus;
}
return $this;
}
/**
* @param NewBonus $bonus
* @return $this
*/
public function removeNewBonus(NewBonus $bonus): self
{
$this->newBonuses->removeElement($bonus);
return $this;
}
}