src/Entity/Otpusk/GeoCategoryValues.php line 15

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Otpusk;
  3. use App\Repository\Otpusk\GeoCategoryValuesRepository;
  4. use Doctrine\Common\Collections\ArrayCollection;
  5. use Doctrine\Common\Collections\Collection;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Gedmo\Mapping\Annotation as Gedmo;
  8. /**
  9.  * @ORM\Entity(repositoryClass=GeoCategoryValuesRepository::class)
  10.  */
  11. class GeoCategoryValues
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @ORM\ManyToOne(targetEntity="App\Entity\Otpusk\Market", inversedBy="marketCategoryValues")
  21.      * @ORM\JoinColumn(name="market_id", referencedColumnName="id", nullable=true, onDelete="CASCADE")
  22.      */
  23.     private $market;
  24.     /**
  25.      * @ORM\ManyToOne(targetEntity="App\Entity\Otpusk\GeoCategory", inversedBy="values")
  26.      * @ORM\JoinColumn(name="category_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
  27.      */
  28.     private $category;
  29.     /**
  30.      * @ORM\ManyToOne(targetEntity="App\Entity\Otpusk\Country", inversedBy="countryCategoryValues")
  31.      * @ORM\JoinColumn(name="country_id", referencedColumnName="rec_id", nullable=true)
  32.      */
  33.     private $country;
  34.     /**
  35.      * @ORM\ManyToOne(targetEntity="App\Entity\Otpusk\City", inversedBy="cityCategoryValues")
  36.      * @ORM\JoinColumn(name="city_id", referencedColumnName="rec_id", nullable=true)
  37.      */
  38.     private $city;
  39.     /**
  40.      * @var integer
  41.      * @Gedmo\SortablePosition
  42.      * @ORM\Column(name="priority", type="integer", options={"default":0}, nullable=true)
  43.      */
  44.     private $position 0;
  45.     public function getId(): ?int
  46.     {
  47.         return $this->id;
  48.     }
  49.     public function getCategory(): ?GeoCategory
  50.     {
  51.         return $this->category;
  52.     }
  53.     public function setCategory(?GeoCategory $category): self
  54.     {
  55.         $this->category $category;
  56.         return $this;
  57.     }
  58.     public function getMarket(): ?Market
  59.     {
  60.         return $this->market;
  61.     }
  62.     public function setMarket(?Market $market): self
  63.     {
  64.         $this->market $market;
  65.         return $this;
  66.     }
  67.     public function getCountry(): ?Country
  68.     {
  69.         return $this->country;
  70.     }
  71.     public function setCountry(?Country $country): self
  72.     {
  73.         $this->country $country;
  74.         return $this;
  75.     }
  76.     public function getCity(): ?City
  77.     {
  78.         return $this->city;
  79.     }
  80.     public function setCity(?City $city): self
  81.     {
  82.         $this->city $city;
  83.         return $this;
  84.     }
  85.     public function getPosition(): ?int
  86.     {
  87.         return $this->position;
  88.     }
  89.     public function setPosition(?int $position): self
  90.     {
  91.         $this->position = (!is_null($position))?$position:0;
  92.         return $this;
  93.     }
  94.     public function __toString()
  95.     {
  96.         return
  97.             ($this->getCountry()?$this->getCountry()->getName().' ':'').
  98.             ($this->getCity()?$this->getCity()->getName().  ' ':'')
  99.             ;
  100.     }
  101. }