src/Entity/Region.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Doctrine\DBAL\Types\Types;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use App\Repository\RegionRepository;
  6. use Doctrine\Common\Collections\Collection;
  7. use ApiPlatform\Core\Annotation\ApiResource;
  8. use App\Entity\Translation\RegionTranslation;
  9. use Doctrine\Common\Collections\ArrayCollection;
  10. use Gedmo\Mapping\Annotation\TranslationEntity;
  11. use Gedmo\Mapping\Annotation\Locale as GedmoLocale;
  12. use Gedmo\Mapping\Annotation\Translatable as GedmoTranslatable;
  13. #[ORM\Entity(repositoryClassRegionRepository::class)]
  14. #[TranslationEntity(class: RegionTranslation::class)]
  15. class Region implements EntityInterface
  16. {
  17.     #[ORM\Id]
  18.     #[ORM\GeneratedValue]
  19.     #[ORM\Column]
  20.     private ?int $id null;
  21.     #[ORM\Column(length255)]
  22.     private ?string $fias_id null;
  23.     #[GedmoTranslatable]
  24.     #[ORM\Column(length255)]    
  25.     private ?string $name null;
  26.     #[ORM\Column(typeTypes::SMALLINT)]
  27.     private ?int $prior null;
  28.     #[ORM\Column]
  29.     private ?bool $visible null;
  30.     #[GedmoLocale]
  31.     private $locale;
  32.     #[ORM\OneToMany(targetEntityRegionTranslation::class, mappedBy'object'cascade: ['persist''remove'])]
  33.     private $translations;
  34.     public function __construct()
  35.     {
  36.         $this->translations = new ArrayCollection();
  37.     }
  38.     public function setLocale($locale)
  39.     {
  40.         $this->locale $locale;
  41.     }
  42.     public function getTranslations()
  43.     {
  44.         return $this->translations;
  45.     }
  46.     public function addTranslation(RegionTranslation $t)
  47.     {
  48.         if (!$this->translations->contains($t)) {
  49.             $this->translations[] = $t;
  50.             $t->setObject($this);
  51.         }
  52.     }
  53.     public function getId(): ?int
  54.     {
  55.         return $this->id;
  56.     }
  57.     public function getFiasId(): ?string
  58.     {
  59.         return $this->fias_id;
  60.     }
  61.     public function setFiasId(string $fias_id): self
  62.     {
  63.         $this->fias_id $fias_id;
  64.         return $this;
  65.     }
  66.     public function getName(): ?string
  67.     {
  68.         return $this->name;
  69.     }
  70.     public function setName(string $name): self
  71.     {
  72.         $this->name $name;
  73.         return $this;
  74.     }
  75.     public function getPrior(): ?int
  76.     {
  77.         return $this->prior;
  78.     }
  79.     public function setPrior(int $prior): self
  80.     {
  81.         $this->prior $prior;
  82.         return $this;
  83.     }
  84.     public function isVisible(): ?bool
  85.     {
  86.         return $this->visible;
  87.     }
  88.     public function setVisible(bool $visible): self
  89.     {
  90.         $this->visible $visible;
  91.         return $this;
  92.     }
  93. }