<?php
namespace App\Entity\Otpusk;
use App\Repository\Otpusk\GeoCategoryValuesRepository;
use Doctrine\Common\Collections\ArrayCollection;
use Doctrine\Common\Collections\Collection;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass=GeoCategoryValuesRepository::class)
*/
class GeoCategoryValues
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Otpusk\Market", inversedBy="marketCategoryValues")
* @ORM\JoinColumn(name="market_id", referencedColumnName="id", nullable=true, onDelete="CASCADE")
*/
private $market;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Otpusk\GeoCategory", inversedBy="values")
* @ORM\JoinColumn(name="category_id", referencedColumnName="id", nullable=false, onDelete="CASCADE")
*/
private $category;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Otpusk\Country", inversedBy="countryCategoryValues")
* @ORM\JoinColumn(name="country_id", referencedColumnName="rec_id", nullable=true)
*/
private $country;
/**
* @ORM\ManyToOne(targetEntity="App\Entity\Otpusk\City", inversedBy="cityCategoryValues")
* @ORM\JoinColumn(name="city_id", referencedColumnName="rec_id", nullable=true)
*/
private $city;
/**
* @var integer
* @Gedmo\SortablePosition
* @ORM\Column(name="priority", type="integer", options={"default":0}, nullable=true)
*/
private $position = 0;
public function getId(): ?int
{
return $this->id;
}
public function getCategory(): ?GeoCategory
{
return $this->category;
}
public function setCategory(?GeoCategory $category): self
{
$this->category = $category;
return $this;
}
public function getMarket(): ?Market
{
return $this->market;
}
public function setMarket(?Market $market): self
{
$this->market = $market;
return $this;
}
public function getCountry(): ?Country
{
return $this->country;
}
public function setCountry(?Country $country): self
{
$this->country = $country;
return $this;
}
public function getCity(): ?City
{
return $this->city;
}
public function setCity(?City $city): self
{
$this->city = $city;
return $this;
}
public function getPosition(): ?int
{
return $this->position;
}
public function setPosition(?int $position): self
{
$this->position = (!is_null($position))?$position:0;
return $this;
}
public function __toString()
{
return
($this->getCountry()?$this->getCountry()->getName().' ':'').
($this->getCity()?$this->getCity()->getName(). ' ':'')
;
}
}