src/CasinoBundle/Entity/City.php line 33

Open in your IDE?
  1. <?php
  2. namespace App\CasinoBundle\Entity;
  3. use App\CmsBundle\Entity\PublishedTrait;
  4. use App\CmsBundle\Entity\TimeStampedTrait;
  5. use Doctrine\Common\Collections\ArrayCollection;
  6. use Doctrine\Common\Collections\Collection;
  7. use App\CmsBundle\Entity\HideTrait;
  8. use App\CmsBundle\Entity\SlugTrait;
  9. use Doctrine\ORM\Mapping as ORM;
  10. /**
  11.  * City
  12.  *
  13.  * @ORM\Table(
  14.  *     name="city",
  15.  *     indexes={
  16.  *          @ORM\Index(name="city_id_index", columns={"id"}),
  17.  *          @ORM\Index(name="city_lat_index", columns={"lat"}),
  18.  *          @ORM\Index(name="city_lng_index", columns={"lng"}),
  19.  *          @ORM\Index(name="city_published_index", columns={"published"}),
  20.  *          @ORM\Index(name="city_capital_index", columns={"capital"}),
  21.  *          @ORM\Index(name="city_population_index", columns={"population"}),
  22.  *     },
  23.  *     uniqueConstraints={
  24.  *        @ORM\UniqueConstraint(name="city_slug_uindex", columns={"slug"})
  25.  *     }
  26.  * )
  27.  * @ORM\Entity(repositoryClass="App\CasinoBundle\Repository\CityRepository")
  28.  * @ORM\HasLifecycleCallbacks()
  29.  */
  30. class City
  31. {
  32.     use SlugTrait;
  33.     use AliasTrait;
  34.     use PublishedTrait;
  35.     use TimeStampedTrait;
  36.     /**
  37.      * @var int
  38.      *
  39.      * @ORM\Column(name="id", type="bigint", nullable=false)
  40.      * @ORM\Id
  41.      * @ORM\GeneratedValue(strategy="IDENTITY")
  42.      */
  43.     private $id;
  44.     /**
  45.      * @var string|null
  46.      *
  47.      * @ORM\Column(name="name", type="string", length=35, nullable=true)
  48.      */
  49.     private $name;
  50.     /**
  51.      * @var string|null
  52.      *
  53.      * @ORM\Column(name="city_ascii", type="string", length=34, nullable=true)
  54.      */
  55.     private $cityAscii;
  56.     /**
  57.      * @var float|null
  58.      *
  59.      * @ORM\Column(name="lat", type="float", precision=10, scale=0, nullable=true)
  60.      */
  61.     private $lat;
  62.     /**
  63.      * @var float|null
  64.      *
  65.      * @ORM\Column(name="lng", type="float", precision=10, scale=0, nullable=true)
  66.      */
  67.     private $lng;
  68.     /**
  69.      * @var string|null
  70.      *
  71.      * @ORM\Column(name="country", type="string", length=45, nullable=true)
  72.      */
  73.     private $countryText;
  74.     /**
  75.      * @var string|null
  76.      *
  77.      * @ORM\Column(name="iso2", type="string", length=2, nullable=true)
  78.      */
  79.     private $iso2;
  80.     /**
  81.      * @var string|null
  82.      *
  83.      * @ORM\Column(name="iso3", type="string", length=3, nullable=true)
  84.      */
  85.     private $iso3;
  86.     /**
  87.      * @var string|null
  88.      *
  89.      * @ORM\Column(name="admin_name", type="string", length=54, nullable=true)
  90.      */
  91.     private $adminName;
  92.     /**
  93.      * @var string|null
  94.      *
  95.      * @ORM\Column(name="capital", type="boolean", nullable=true)
  96.      */
  97.     private $capital;
  98.     /**
  99.      * @var float|null
  100.      *
  101.      * @ORM\Column(name="population", type="float", precision=10, scale=0, nullable=true)
  102.      */
  103.     private $population;
  104.     /**
  105.      * @var Country|null
  106.      * @ORM\ManyToOne(targetEntity="Country", inversedBy="cities")
  107.      * @ORM\JoinColumn(name="country_id", referencedColumnName="id")
  108.      */
  109.     private $country;
  110.     /**
  111.      * @var State|null
  112.      * @ORM\ManyToOne(targetEntity="State", inversedBy="cities")
  113.      * @ORM\JoinColumn(name="state_id", referencedColumnName="id")
  114.      */
  115.     private $state;
  116.     /**
  117.      * @ORM\OneToMany(targetEntity="App\CasinoBundle\Entity\OfflineCasino", mappedBy="city", cascade={"persist"}, orphanRemoval=true)
  118.      */
  119.     private $offlineCasinos;
  120.     /**
  121.      * @ORM\OneToMany(targetEntity="App\CasinoBundle\Entity\Alias", mappedBy="city", cascade={"persist"}, orphanRemoval=true)
  122.      */
  123.     private Collection $aliases;
  124.     public function __toString()
  125.     {
  126.         return $this->name;
  127.     }
  128.     public function __construct()
  129.     {
  130.         $this->aliases = new ArrayCollection();
  131.     }
  132.     /**
  133.      * @return int
  134.      */
  135.     public function getId(): int
  136.     {
  137.         return $this->id;
  138.     }
  139.     /**
  140.      * @param int $id
  141.      */
  142.     public function setId(int $id): void
  143.     {
  144.         $this->id $id;
  145.     }
  146.     /**
  147.      * @return null|string
  148.      */
  149.     public function getName(): ?string
  150.     {
  151.         return $this->name;
  152.     }
  153.     /**
  154.      * @param null|string $name
  155.      */
  156.     public function setName(?string $name): void
  157.     {
  158.         $this->name $name;
  159.     }
  160.     /**
  161.      * @return null|string
  162.      */
  163.     public function getCityAscii(): ?string
  164.     {
  165.         return $this->cityAscii;
  166.     }
  167.     /**
  168.      * @param null|string $cityAscii
  169.      */
  170.     public function setCityAscii(?string $cityAscii): void
  171.     {
  172.         $this->cityAscii $cityAscii;
  173.     }
  174.     public function getLat(): ?float
  175.     {
  176.         return $this->lat;
  177.     }
  178.     public function setLat(?float $lat): self
  179.     {
  180.         $this->lat $lat;
  181.         return $this;
  182.     }
  183.     public function getLng(): ?float
  184.     {
  185.         return $this->lng;
  186.     }
  187.     public function setLng(?float $lng): self
  188.     {
  189.         $this->lng $lng;
  190.         return $this;
  191.     }
  192.     /**
  193.      * @return null|string
  194.      */
  195.     public function getCountryText(): ?string
  196.     {
  197.         return $this->countryText;
  198.     }
  199.     /**
  200.      * @param null|string $countryText
  201.      */
  202.     public function setCountryText(?string $countryText): void
  203.     {
  204.         $this->countryText $countryText;
  205.     }
  206.     /**
  207.      * @return null|string
  208.      */
  209.     public function getIso2(): ?string
  210.     {
  211.         return $this->iso2;
  212.     }
  213.     /**
  214.      * @param null|string $iso2
  215.      */
  216.     public function setIso2(?string $iso2): void
  217.     {
  218.         $this->iso2 $iso2;
  219.     }
  220.     /**
  221.      * @return null|string
  222.      */
  223.     public function getIso3(): ?string
  224.     {
  225.         return $this->iso3;
  226.     }
  227.     /**
  228.      * @param null|string $iso3
  229.      */
  230.     public function setIso3(?string $iso3): void
  231.     {
  232.         $this->iso3 $iso3;
  233.     }
  234.     /**
  235.      * @return null|string
  236.      */
  237.     public function getAdminName(): ?string
  238.     {
  239.         return $this->adminName;
  240.     }
  241.     /**
  242.      * @param null|string $adminName
  243.      */
  244.     public function setAdminName(?string $adminName): void
  245.     {
  246.         $this->adminName $adminName;
  247.     }
  248.     public function getCapital(): bool
  249.     {
  250.         return (bool)$this->capital;
  251.     }
  252.     public function setCapital(?bool $capital): self
  253.     {
  254.         if ($this->country) {
  255.             $this->country->setCapitalCity($this);
  256.             $this->capital $capital;
  257.         }
  258.         return $this;
  259.     }
  260.     /**
  261.      * @return float|null
  262.      */
  263.     public function getPopulation(): ?float
  264.     {
  265.         return $this->population;
  266.     }
  267.     /**
  268.      * @param float|null $population
  269.      */
  270.     public function setPopulation(?float $population): void
  271.     {
  272.         $this->population $population;
  273.     }
  274.     /**
  275.      * @return Country
  276.      */
  277.     public function getCountry(): ?Country
  278.     {
  279.         return $this->country;
  280.     }
  281.     /**
  282.      * @param Country $country
  283.      * @return City
  284.      */
  285.     public function setCountry(Country $country): self
  286.     {
  287.         $this->country $country;
  288.         return $this;
  289.     }
  290.     /**
  291.      * @return State
  292.      */
  293.     public function getState(): ?State
  294.     {
  295.         return $this->state;
  296.     }
  297.     /**
  298.      * @param State $state
  299.      * @return City
  300.      */
  301.     public function setState(State $state): self
  302.     {
  303.         $this->state $state;
  304.         return $this;
  305.     }
  306. }