src/CasinoBundle/Entity/Owner.php line 18

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.  * Owner
  8.  *
  9.  * @ORM\Table(name="owner",
  10.  *     uniqueConstraints={
  11.  *          @ORM\UniqueConstraint(name="owner_name_uindex", columns={"name"})
  12.  *     }
  13.  * )
  14.  * @ORM\Entity(repositoryClass="App\CasinoBundle\Repository\OwnerRepository")
  15.  */
  16. class Owner
  17. {
  18.     /**
  19.      * @var int
  20.      *
  21.      * @ORM\Column(name="id", type="integer", nullable=false)
  22.      * @ORM\Id
  23.      * @ORM\GeneratedValue(strategy="IDENTITY")
  24.      */
  25.     private $id;
  26.     /**
  27.      * @var string
  28.      *
  29.      * @ORM\Column(name="name", type="string", length=255, nullable=false)
  30.      */
  31.     private $name;
  32.     /**
  33.      * @var string
  34.      *
  35.      * @ORM\Column(name="website", type="string", length=255, nullable=true)
  36.      */
  37.     private $website;
  38.     /**
  39.      * @var string
  40.      *
  41.      * @ORM\Column(name="address", type="text", nullable=true)
  42.      */
  43.     private $address;
  44.     /**
  45.      * @var float
  46.      *
  47.      * @ORM\Column(name="rating", type="float", nullable=true)
  48.      */
  49.     private $rating;
  50.     /**
  51.      * @ORM\ManyToMany(targetEntity="App\CasinoBundle\Entity\Casino", mappedBy="owners")
  52.      */
  53.     private $casinos;
  54.     public function __construct()
  55.     {
  56.         $this->casinos = new ArrayCollection();
  57.     }
  58.     public function __toString(): string
  59.     {
  60.         return $this->name;
  61.     }
  62.     /**
  63.      * @return int
  64.      */
  65.     public function getId(): int
  66.     {
  67.         return $this->id;
  68.     }
  69.     /**
  70.      * @param int $id
  71.      */
  72.     public function setId(int $id): void
  73.     {
  74.         $this->id $id;
  75.     }
  76.     /**
  77.      * @return string
  78.      */
  79.     public function getName(): ?string
  80.     {
  81.         return $this->name;
  82.     }
  83.     /**
  84.      * @param string $name
  85.      * @return $this
  86.      */
  87.     public function setName(string $name): self
  88.     {
  89.         $this->name $name;
  90.         return $this;
  91.     }
  92.     /**
  93.      * @return string
  94.      */
  95.     public function getWebsite(): ?string
  96.     {
  97.         return $this->website;
  98.     }
  99.     /**
  100.      * @param string $website
  101.      */
  102.     public function setWebsite(string $website): void
  103.     {
  104.         $this->website $website;
  105.     }
  106.     /**
  107.      * @return float
  108.      */
  109.     public function getRating(): ?float
  110.     {
  111.         return $this->rating;
  112.     }
  113.     /**
  114.      * @param float $rating
  115.      */
  116.     public function setRating(?float $rating): self
  117.     {
  118.         $this->rating $rating;
  119.         return $this;
  120.     }
  121.     /**
  122.      * @return string
  123.      */
  124.     public function getAddress(): ?string
  125.     {
  126.         return $this->address;
  127.     }
  128.     /**
  129.      * @param string $address
  130.      */
  131.     public function setAddress(string $address): void
  132.     {
  133.         $this->address $address;
  134.     }
  135.     /**
  136.      * @return Collection|Casino[]
  137.      */
  138.     public function getCasinos(): Collection
  139.     {
  140.         return $this->casinos;
  141.     }
  142.     public function addCasino(Casino $casino): self
  143.     {
  144.         if (!$this->casinos->contains($casino)) {
  145.             $this->casinos[] = $casino;
  146.             $casino->addOwner($this);
  147.         }
  148.         return $this;
  149.     }
  150.     public function removeCasino(Casino $casino): self
  151.     {
  152.         if ($this->casinos->contains($casino)) {
  153.             $this->casinos->removeElement($casino);
  154.             $casino->removeOwner($this);
  155.         }
  156.         return $this;
  157.     }
  158. }