src/Entity/Otpusk/RubricCity.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\RubricCityRepository")
  7.  * @ORM\Table(
  8.  *     name="RubricCity"
  9.  * )
  10.  */
  11. class RubricCity
  12. {
  13.     /**
  14.      * @ORM\Id
  15.      * @ORM\GeneratedValue
  16.      * @ORM\Column(type="integer")
  17.      */
  18.     private $id;
  19.     /**
  20.      * @var City
  21.      *
  22.      * @ORM\ManyToOne(targetEntity="App\Entity\Otpusk\City", inversedBy="rubrics")
  23.      * @ORM\JoinColumn(name="city_id", referencedColumnName="rec_id", nullable=true, onDelete="CASCADE")
  24.      *
  25.      */
  26.     private $city;
  27.     /**
  28.      * @var Rubric
  29.      *
  30.      * @ORM\ManyToOne(targetEntity="App\Entity\Otpusk\Rubric", inversedBy="cities")
  31.      * @ORM\JoinColumn(name="rubric_id", referencedColumnName="id", nullable=true, onDelete="CASCADE")
  32.      *
  33.      */
  34.     private $rubric;
  35.     public function getId(): ?int
  36.     {
  37.         return $this->id;
  38.     }
  39.     public function setId($id): self
  40.     {
  41.         $this->id $id;
  42.         return $this;
  43.     }
  44.     public function getCity(): ?City
  45.     {
  46.         return $this->city;
  47.     }
  48.     public function setCity(?City $city): self
  49.     {
  50.         $this->city $city;
  51.         return $this;
  52.     }
  53.     public function getRubric(): ?Rubric
  54.     {
  55.         return $this->rubric;
  56.     }
  57.     public function setRubric(?Rubric $rubric): self
  58.     {
  59.         $this->rubric $rubric;
  60.         return $this;
  61.     }
  62.     public function __toString()
  63.     {
  64.         return $this->getCity()->getName();
  65.     }
  66. }