src/Entity/District.php line 9

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\DistrictRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClassDistrictRepository::class), ORM\Table(name'districts')]
  6. class District implements \Stringable
  7. {
  8.     #[ORM\IdORM\GeneratedValueORM\Column(type'integer')]
  9.     private $id;
  10.     #[ORM\Column(type'string'length255)]
  11.     private $name;
  12.     #[ORM\Column(type'string'length100uniquetrue)]
  13.     private $code;
  14.     #[ORM\ManyToOne(targetEntityState::class), ORM\JoinColumn(nullablefalse)]
  15.     private $state;
  16.     public function getId(): ?int
  17.     {
  18.         return $this->id;
  19.     }
  20.     public function getName(): ?string
  21.     {
  22.         return $this->name;
  23.     }
  24.     public function setName(string $name): self
  25.     {
  26.         $this->name $name;
  27.         return $this;
  28.     }
  29.     public function getState(): ?State
  30.     {
  31.         return $this->state;
  32.     }
  33.     public function setState(State $state): self
  34.     {
  35.         $this->state $state;
  36.         return $this;
  37.     }
  38.     public function getCode(): ?string
  39.     {
  40.         return $this->code;
  41.     }
  42.     public function setCode(string $code): self
  43.     {
  44.         $this->code $code;
  45.         return $this;
  46.     }
  47.     public function __toString(): string
  48.     {
  49.         return $this->getName();
  50.     }
  51. }