<?php
namespace App\CasinoBundle\Entity;
use App\CmsBundle\Entity\PositionTrait;
use App\CmsBundle\Entity\PublishedTrait;
use App\CmsBundle\Entity\SlugTrait;
use App\CmsBundle\Entity\TimeStampedTrait;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
/**
* Software
*
* @ORM\Table(
* name="software",
* uniqueConstraints={
* @ORM\UniqueConstraint(name="software_slug_uindex", columns={"slug"}),
* @ORM\UniqueConstraint(name="software_name_uindex", columns={"name"})
* },
* indexes={
* @ORM\Index(name="software_published_index", columns={"published"}),
* @ORM\Index(name="software_position_index", columns={"position"})
* }
* )
* @ORM\Entity(repositoryClass="App\CasinoBundle\Repository\SoftwareRepository")
* @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="one_day")
* @ORM\HasLifecycleCallbacks()
*/
class Software
{
use SlugTrait;
use PublishedTrait;
use PositionTrait;
use AliasTrait;
use LogoTrait;
use SlotcatalogIdTrait;
use TimeStampedTrait;
/**
* @var int
*
* @ORM\Column(name="id", type="integer", nullable=false)
* @ORM\Id
* @ORM\GeneratedValue()
*/
private $id;
/**
* @var string|null
*
* @ORM\Column(name="name", type="string", length=255, nullable=true)
*/
private $name;
/**
* @var string|null
*
* @ORM\Column(name="url", type="string", length=255, nullable=true)
*/
private $url;
/**
* @var string|null
*
* @ORM\Column(name="name_base", type="string", length=255, nullable=true)
*/
private $nameBase;
/**
* @ORM\ManyToMany(targetEntity="App\CasinoBundle\Entity\Casino", mappedBy="softwares")
*/
private $casinos;
/**
* @ORM\OneToMany(targetEntity="App\CasinoBundle\Entity\Alias", mappedBy="software", cascade={"persist"}, orphanRemoval=true)
*/
private Collection $aliases;
/**
* @ORM\OneToMany(targetEntity="App\CmsBundle\Entity\DirectoryItem", fetch="EXTRA_LAZY", mappedBy="software")
*/
private Collection $directoryItems;
/**
* @ORM\OneToMany(targetEntity="App\CasinoBundle\Entity\Slot", fetch="EXTRA_LAZY", mappedBy="software", cascade={"persist"})
*/
private $slots;
public function __construct()
{
$this->casinos = new ArrayCollection();
$this->aliases = new ArrayCollection();
$this->directoryItems = new ArrayCollection();
$this->slots = new ArrayCollection();
}
/**
* @return string
*/
public function __toString(): string
{
return (string)$this->name;
}
/**
* @return int
*/
public function getId(): int
{
return $this->id;
}
/**
* @param int $id
*/
public function setId(int $id): void
{
$this->id = $id;
}
/**
* @return null|string
*/
public function getName(): ?string
{
return $this->name;
}
/**
* @param null|string $name
* @return Software
*/
public function setName(?string $name): self
{
$this->name = $name;
return $this;
}
/**
* @return null|string
*/
public function getUrl(): ?string
{
return $this->url;
}
/**
* @param null|string $url
* @return Software
*/
public function setUrl(?string $url): self
{
$this->url = $url;
return $this;
}
/**
* @return null|string
*/
public function getNameBase(): ?string
{
return $this->nameBase;
}
/**
* @param ?string $nameBase
* @return Software
*/
public function setNameBase(?string $nameBase): self
{
$this->nameBase = $nameBase;
return $this;
}
/**
* @return Collection
*/
public function getCasinos(): Collection
{
return $this->casinos;
}
/**
* @param Casino $casino
* @return $this
*/
public function addCasino(Casino $casino): self
{
if (!$this->casinos->contains($casino)) {
$this->casinos[] = $casino;
$casino->addSoftware($this);
}
return $this;
}
/**
* @param Casino $casino
* @return $this
*/
public function removeCasino(Casino $casino): self
{
if ($this->casinos->contains($casino)) {
$this->casinos->removeElement($casino);
$casino->removeSoftware($this);
}
return $this;
}
/**
* @return Collection
*/
public function getSlots(): Collection
{
return $this->slots;
}
/**
* @return int
*/
public function getCountOfSlots(): int
{
return $this->slots->count();
}
/**
* @return Collection
*/
public function getDirectoryItems(): Collection
{
return $this->directoryItems;
}
}