src/CasinoBundle/Entity/Software.php line 31

Open in your IDE?
  1. <?php
  2. namespace App\CasinoBundle\Entity;
  3. use App\CmsBundle\Entity\PositionTrait;
  4. use App\CmsBundle\Entity\PublishedTrait;
  5. use App\CmsBundle\Entity\SlugTrait;
  6. use App\CmsBundle\Entity\TimeStampedTrait;
  7. use Doctrine\Common\Collections\ArrayCollection;
  8. use Doctrine\Common\Collections\Collection;
  9. use Doctrine\ORM\Mapping as ORM;
  10. /**
  11.  * Software
  12.  *
  13.  * @ORM\Table(
  14.  *     name="software",
  15.  *     uniqueConstraints={
  16.  *          @ORM\UniqueConstraint(name="software_slug_uindex", columns={"slug"}),
  17.  *          @ORM\UniqueConstraint(name="software_name_uindex", columns={"name"})
  18.  *     },
  19.  *     indexes={
  20.  *          @ORM\Index(name="software_published_index", columns={"published"}),
  21.  *          @ORM\Index(name="software_position_index", columns={"position"})
  22.  *     }
  23.  * )
  24.  * @ORM\Entity(repositoryClass="App\CasinoBundle\Repository\SoftwareRepository")
  25.  * @ORM\Cache(usage="NONSTRICT_READ_WRITE", region="one_day")
  26.  * @ORM\HasLifecycleCallbacks()
  27.  */
  28. class Software
  29. {
  30.     use SlugTrait;
  31.     use PublishedTrait;
  32.     use PositionTrait;
  33.     use AliasTrait;
  34.     use LogoTrait;
  35.     use SlotcatalogIdTrait;
  36.     use TimeStampedTrait;
  37.     /**
  38.      * @var int
  39.      *
  40.      * @ORM\Column(name="id", type="integer", nullable=false)
  41.      * @ORM\Id
  42.      * @ORM\GeneratedValue()
  43.      */
  44.     private $id;
  45.     /**
  46.      * @var string|null
  47.      *
  48.      * @ORM\Column(name="name", type="string", length=255, nullable=true)
  49.      */
  50.     private $name;
  51.     /**
  52.      * @var string|null
  53.      *
  54.      * @ORM\Column(name="url", type="string", length=255, nullable=true)
  55.      */
  56.     private $url;
  57.     /**
  58.      * @var string|null
  59.      *
  60.      * @ORM\Column(name="name_base", type="string", length=255, nullable=true)
  61.      */
  62.     private $nameBase;
  63.     /**
  64.      * @ORM\ManyToMany(targetEntity="App\CasinoBundle\Entity\Casino", mappedBy="softwares")
  65.      */
  66.     private $casinos;
  67.     /**
  68.      * @ORM\OneToMany(targetEntity="App\CasinoBundle\Entity\Alias", mappedBy="software", cascade={"persist"}, orphanRemoval=true)
  69.      */
  70.     private Collection $aliases;
  71.     /**
  72.      * @ORM\OneToMany(targetEntity="App\CmsBundle\Entity\DirectoryItem", fetch="EXTRA_LAZY", mappedBy="software")
  73.      */
  74.     private Collection $directoryItems;
  75.     /**
  76.      * @ORM\OneToMany(targetEntity="App\CasinoBundle\Entity\Slot", fetch="EXTRA_LAZY", mappedBy="software", cascade={"persist"})
  77.      */
  78.     private $slots;
  79.     public function __construct()
  80.     {
  81.         $this->casinos = new ArrayCollection();
  82.         $this->aliases = new ArrayCollection();
  83.         $this->directoryItems = new ArrayCollection();
  84.         $this->slots = new ArrayCollection();
  85.     }
  86.     /**
  87.      * @return string
  88.      */
  89.     public function __toString(): string
  90.     {
  91.         return (string)$this->name;
  92.     }
  93.     /**
  94.      * @return int
  95.      */
  96.     public function getId(): int
  97.     {
  98.         return $this->id;
  99.     }
  100.     /**
  101.      * @param int $id
  102.      */
  103.     public function setId(int $id): void
  104.     {
  105.         $this->id $id;
  106.     }
  107.     /**
  108.      * @return null|string
  109.      */
  110.     public function getName(): ?string
  111.     {
  112.         return $this->name;
  113.     }
  114.     /**
  115.      * @param null|string $name
  116.      * @return Software
  117.      */
  118.     public function setName(?string $name): self
  119.     {
  120.         $this->name $name;
  121.         return $this;
  122.     }
  123.     /**
  124.      * @return null|string
  125.      */
  126.     public function getUrl(): ?string
  127.     {
  128.         return $this->url;
  129.     }
  130.     /**
  131.      * @param null|string $url
  132.      * @return Software
  133.      */
  134.     public function setUrl(?string $url): self
  135.     {
  136.         $this->url $url;
  137.         return $this;
  138.     }
  139.     /**
  140.      * @return null|string
  141.      */
  142.     public function getNameBase(): ?string
  143.     {
  144.         return $this->nameBase;
  145.     }
  146.     /**
  147.      * @param ?string $nameBase
  148.      * @return Software
  149.      */
  150.     public function setNameBase(?string $nameBase): self
  151.     {
  152.         $this->nameBase $nameBase;
  153.         return $this;
  154.     }
  155.     /**
  156.      * @return Collection
  157.      */
  158.     public function getCasinos(): Collection
  159.     {
  160.         return $this->casinos;
  161.     }
  162.     /**
  163.      * @param Casino $casino
  164.      * @return $this
  165.      */
  166.     public function addCasino(Casino $casino): self
  167.     {
  168.         if (!$this->casinos->contains($casino)) {
  169.             $this->casinos[] = $casino;
  170.             $casino->addSoftware($this);
  171.         }
  172.         return $this;
  173.     }
  174.     /**
  175.      * @param Casino $casino
  176.      * @return $this
  177.      */
  178.     public function removeCasino(Casino $casino): self
  179.     {
  180.         if ($this->casinos->contains($casino)) {
  181.             $this->casinos->removeElement($casino);
  182.             $casino->removeSoftware($this);
  183.         }
  184.         return $this;
  185.     }
  186.     /**
  187.      * @return Collection
  188.      */
  189.     public function getSlots(): Collection
  190.     {
  191.         return $this->slots;
  192.     }
  193.     /**
  194.      * @return int
  195.      */
  196.     public function getCountOfSlots(): int
  197.     {
  198.         return $this->slots->count();
  199.     }
  200.     /**
  201.      * @return Collection
  202.      */
  203.     public function getDirectoryItems(): Collection
  204.     {
  205.         return $this->directoryItems;
  206.     }
  207. }