src/Entity/Geo/Region.php line 16

  1. <?php
  2. namespace App\Entity\Geo;
  3. use App\Entity\Traits\ActiveTrait;
  4. use App\Entity\Traits\TrackerFields;
  5. use App\Entity\Traits\UserCreatedInterface;
  6. use App\Entity\Traits\UserUpdatedInterface;
  7. use App\Model\Translation\TranslatableTrait;
  8. use Doctrine\ORM\Mapping as ORM;
  9. use Knp\DoctrineBehaviors\Contract\Entity\TranslatableInterface;
  10. #[ORM\Table(name'federal_region')]
  11. #[ORM\Entity(repositoryClass'App\Repository\Geo\RegionRepository')]
  12. #[ORM\HasLifecycleCallbacks]
  13. class Region implements UserCreatedInterfaceUserUpdatedInterfaceTranslatableInterface
  14. {
  15.     use TrackerFields;
  16.     use ActiveTrait;
  17.     use TranslatableTrait;
  18.     /**
  19.      * @var ?int
  20.      */
  21.     #[ORM\Id]
  22.     #[ORM\GeneratedValue(strategy'AUTO')]
  23.     #[ORM\Column(type'integer')]
  24.     private $id;
  25.     /**
  26.      * @var ?string
  27.      */
  28.     #[ORM\Column(type'string'nullabletrue)]
  29.     private $caption;
  30.     /**
  31.      * @var int
  32.      */
  33.     #[ORM\Column(type'integer'nullablefalseoptions: ['default' => 10])]
  34.     private $weight 10;
  35.     /**
  36.      * @var int
  37.      */
  38.     #[ORM\Column(type'integer'nullablefalseoptions: ['default' => 10])]
  39.     private int $weight_flat 10;
  40.     /**
  41.      * @var ?string
  42.      */
  43.     #[ORM\Column(type'string'nullabletrue)]
  44.     private $short_caption;
  45.     /**
  46.      * @var ?District
  47.      */
  48.     #[ORM\ManyToOne(targetEntity'App\Entity\Geo\District'inversedBy'regions')]
  49.     #[ORM\JoinColumn(nullablefalse)]
  50.     private $district;
  51.     /**
  52.      * @return int|null
  53.      */
  54.     public function getId(): ?int
  55.     {
  56.         return $this->id;
  57.     }
  58.     /**
  59.      * @param int|null $id
  60.      */
  61.     public function setId(?int $id): void
  62.     {
  63.         $this->id $id;
  64.     }
  65.     /**
  66.      * @return string|null
  67.      */
  68.     public function getCaption(): ?string
  69.     {
  70.         return $this->translate()->getCaption();
  71.     }
  72.     /**
  73.      * @return int
  74.      */
  75.     public function getWeight(): int
  76.     {
  77.         return $this->weight;
  78.     }
  79.     /**
  80.      * @param int $weight
  81.      */
  82.     public function setWeight(int $weight): void
  83.     {
  84.         $this->weight $weight;
  85.     }
  86.     /**
  87.      * @return string|null
  88.      */
  89.     public function getShortCaption(): ?string
  90.     {
  91.         return $this->short_caption;
  92.     }
  93.     /**
  94.      * @param string|null $short_caption
  95.      */
  96.     public function setShortCaption(?string $short_caption): void
  97.     {
  98.         $this->short_caption $short_caption;
  99.     }
  100.     /**
  101.      * @return District|null
  102.      */
  103.     public function getDistrict(): ?District
  104.     {
  105.         return $this->district;
  106.     }
  107.     /**
  108.      * @param District|null $district
  109.      */
  110.     public function setDistrict(?District $district): void
  111.     {
  112.         $this->district $district;
  113.     }
  114.     /**
  115.      * @return int
  116.      */
  117.     public function getWeightFlat(): int
  118.     {
  119.         return $this->weight_flat;
  120.     }
  121.     /**
  122.      * @param int $weight_flat
  123.      */
  124.     public function setWeightFlat(int $weight_flat): void
  125.     {
  126.         $this->weight_flat $weight_flat;
  127.     }
  128. }