<?php
namespace App\Entity\Otpusk;
use Doctrine\ORM\Mapping as ORM;
use Gedmo\Mapping\Annotation as Gedmo;
/**
* @ORM\Entity(repositoryClass="App\Repository\Otpusk\RubricCountryRepository")
* @ORM\Table(
* name="RubricCountry"
* )
*/
class RubricCountry
{
/**
* @ORM\Id
* @ORM\GeneratedValue
* @ORM\Column(type="integer")
*/
private $id;
/**
* @var Country
*
* @ORM\ManyToOne(targetEntity="App\Entity\Otpusk\Country", inversedBy="rubrics")
* @ORM\JoinColumn(name="country_id", referencedColumnName="rec_id", nullable=true, onDelete="CASCADE")
*
*/
private $country;
/**
* @var Rubric
*
* @ORM\ManyToOne(targetEntity="App\Entity\Otpusk\Rubric", inversedBy="countries")
* @ORM\JoinColumn(name="rubric_id", referencedColumnName="id", nullable=true, onDelete="CASCADE")
*
*/
private $rubric;
/**
* @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 getCountry(): ?Country
{
return $this->country;
}
public function setCountry(?Country $country): self
{
$this->country = $country;
return $this;
}
public function getRubric(): ?Rubric
{
return $this->rubric;
}
public function setRubric(?Rubric $rubric): self
{
$this->rubric = $rubric;
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()->getName();
}
}