src/Entity/Otpusk/CitiesSimilar.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity\Otpusk;
  3. use Doctrine\ORM\Mapping as ORM;
  4. use Gedmo\Mapping\Annotation as Gedmo;
  5. /**
  6.  * @ORM\Entity(repositoryClass="App\Repository\Otpusk\CitiesSimilarRepository")
  7.  */
  8. class CitiesSimilar
  9. {
  10.     /**
  11.      * @ORM\Id
  12.      * @ORM\GeneratedValue
  13.      * @ORM\Column(type="integer")
  14.      */
  15.     private $id;
  16.     /**
  17.      * @var City
  18.      *
  19.      * @ORM\ManyToOne(targetEntity="App\Entity\Otpusk\City", inversedBy="similarCities")
  20.      * @ORM\JoinColumn(name="city_similar_id", referencedColumnName="rec_id", nullable=true, onDelete="CASCADE")
  21.      *
  22.      */
  23.     private $citySimilar;
  24.     /**
  25.      * @var City
  26.      *
  27.      * @ORM\ManyToOne(targetEntity="App\Entity\Otpusk\City", inversedBy="similarCitiesIn")
  28.      * @ORM\JoinColumn(name="city_similar_in_id", referencedColumnName="rec_id", nullable=true, onDelete="CASCADE")
  29.      *
  30.      */
  31.     private $citySimilarIn;
  32.     /**
  33.      * @var integer
  34.      * @Gedmo\SortablePosition
  35.      * @ORM\Column(name="priority", type="integer", options={"default":0}, nullable=true)
  36.      */
  37.     private $position 0;
  38.     public function getId(): ?int
  39.     {
  40.         return $this->id;
  41.     }
  42.     public function setId($id): self
  43.     {
  44.         $this->id $id;
  45.         return $this;
  46.     }
  47.     public function getCitySimilar(): ?City
  48.     {
  49.         return $this->citySimilar;
  50.     }
  51.     public function setCitySimilar(?City $citySimilar): self
  52.     {
  53.         $this->citySimilar $citySimilar;
  54.         return $this;
  55.     }
  56.     public function getCitySimilarIn(): ?City
  57.     {
  58.         return $this->citySimilarIn;
  59.     }
  60.     public function setCitySimilarIn(?City $citySimilarIn): self
  61.     {
  62.         $this->citySimilarIn $citySimilarIn;
  63.         return $this;
  64.     }
  65.     public function getPosition(): ?int
  66.     {
  67.         return $this->position;
  68.     }
  69.     public function setPosition(?int $position): self
  70.     {
  71.         $this->position = (!is_null($position)) ? $position 0;
  72.         return $this;
  73.     }
  74.     public function __toString()
  75.     {
  76.         return ($this->getCitySimilar() ? $this->getCitySimilar()->getName() : '') . ' - ' . ($this->getCitySimilarIn() ? $this->getCitySimilarIn()->getName() : '');
  77.     }
  78. }