<?phpnamespace CoreBundle\Entity;use Doctrine\Common\Collections\ArrayCollection;use Doctrine\Common\Collections\Collection;/** * City */class City{ /** * @var int */ private $id; /** * @var string|null */ private $nameRu; /** * @var string|null */ private $nameUa; /** * @var Collection */ private $dealer; /** * Constructor */ public function __construct() { $this->dealer = new ArrayCollection(); } /** * Get id. * * @return int */ public function getId() { return $this->id; } /** * Set nameRu. * * @param string|null $nameRu * * @return City */ public function setNameRu($nameRu = null) { $this->nameRu = $nameRu; return $this; } /** * Get nameRu. * * @return string|null */ public function getNameRu() { return $this->nameRu; } /** * Set nameUa. * * @param string|null $nameUa * * @return City */ public function setNameUa($nameUa = null) { $this->nameUa = $nameUa; return $this; } /** * Get nameUa. * * @return string|null */ public function getNameUa() { return $this->nameUa; } /** * Add dealer. * * @param Dealer $dealer * * @return City */ public function addDealer(Dealer $dealer) { $this->dealer[] = $dealer; return $this; } /** * Remove dealer. * * @param Dealer $dealer * * @return boolean TRUE if this collection contained the specified element, FALSE otherwise. */ public function removeDealer(Dealer $dealer) { return $this->dealer->removeElement($dealer); } /** * Get dealer. * * @return Collection */ public function getDealer() { return $this->dealer; } public function getCityByLocale($locale) { if($locale == 'ru') { return $this->getNameRu(); } return $this->getNameUa(); } public function __toString() { return (string) $this->getNameRu(); }}