<?php
namespace App\Entity\Otpusk;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass="App\Repository\Otpusk\CountriesSimilarRepository")
*/
class CountriesSimilar
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @var Country
*
* @ORM\ManyToOne(targetEntity="App\Entity\Otpusk\Country", inversedBy="similarCountries")
* @ORM\JoinColumn(name="country_similar_id", referencedColumnName="rec_id", nullable=true, onDelete="CASCADE")
*
*/
private $countrySimilar;
/**
* @var Country
*
* @ORM\ManyToOne(targetEntity="App\Entity\Otpusk\Country", inversedBy="similarCountriesIn")
* @ORM\JoinColumn(name="country_similar_in_id", referencedColumnName="rec_id", nullable=true, onDelete="CASCADE")
*
*/
private $countrySimilarIn;
/**
* @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 setId($id): self
{
$this->id = $id;
return $this;
}
public function getCountrySimilar(): ?Country
{
return $this->countrySimilar;
}
public function setCountrySimilar(?Country $countrySimilar): self
{
$this->countrySimilar = $countrySimilar;
return $this;
}
public function getCountrySimilarIn(): ?Country
{
return $this->countrySimilarIn;
}
public function setCountrySimilarIn(?Country $countrySimilarIn): self
{
$this->countrySimilarIn = $countrySimilarIn;
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->getCountrySimilar()->getName().' - '.$this->getCountrySimilarIn()->getName();
}
}