src/Entity/Otpusk/RubricCountry.php line 15

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\RubricCountryRepository")
  7.  * @ORM\Table(
  8.  *     name="RubricCountry"
  9.  * )
  10.  */
  11. class RubricCountry
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @var Country
  21.      *
  22.      * @ORM\ManyToOne(targetEntity="App\Entity\Otpusk\Country", inversedBy="rubrics")
  23.      * @ORM\JoinColumn(name="country_id", referencedColumnName="rec_id", nullable=true, onDelete="CASCADE")
  24.      *
  25.      */
  26.     private $country;
  27.     /**
  28.      * @var Rubric
  29.      *
  30.      * @ORM\ManyToOne(targetEntity="App\Entity\Otpusk\Rubric", inversedBy="countries")
  31.      * @ORM\JoinColumn(name="rubric_id", referencedColumnName="id", nullable=true, onDelete="CASCADE")
  32.      *
  33.      */
  34.     private $rubric;
  35.     /**
  36.      * @var integer
  37.      * @Gedmo\SortablePosition
  38.      * @ORM\Column(name="priority", type="integer", options={"default":0}, nullable=true)
  39.      */
  40.     private $position 0;
  41.     public function getId(): ?int
  42.     {
  43.         return $this->id;
  44.     }
  45.     public function setId($id): self
  46.     {
  47.         $this->id $id;
  48.         return $this;
  49.     }
  50.     public function getCountry(): ?Country
  51.     {
  52.         return $this->country;
  53.     }
  54.     public function setCountry(?Country $country): self
  55.     {
  56.         $this->country $country;
  57.         return $this;
  58.     }
  59.     public function getRubric(): ?Rubric
  60.     {
  61.         return $this->rubric;
  62.     }
  63.     public function setRubric(?Rubric $rubric): self
  64.     {
  65.         $this->rubric $rubric;
  66.         return $this;
  67.     }
  68.     public function getPosition(): ?int
  69.     {
  70.         return $this->position;
  71.     }
  72.     public function setPosition(?int $position): self
  73.     {
  74.         $this->position = (!is_null($position))?$position:0;
  75.         return $this;
  76.     }
  77.     public function __toString()
  78.     {
  79.         return $this->getCountry()->getName();
  80.     }
  81. }