src/Entity/Province.php line 13

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use Gedmo\Blameable\Traits\BlameableEntity;
  4. use Gedmo\Timestampable\Traits\TimestampableEntity;
  5. use App\Repository\ProvinceRepository;
  6. use Doctrine\ORM\Mapping as ORM;
  7. use Symfony\Component\Serializer\Annotation\Groups;
  8. use Symfony\Component\Validator\Constraints as Assert;
  9. #[ORM\Entity(repositoryClassProvinceRepository::class)]
  10. class Province
  11. {
  12.     use BlameableEntity
  13.     use TimestampableEntity;
  14.     #[ORM\Id]
  15.     #[ORM\GeneratedValue(strategy"IDENTITY")]
  16.     #[ORM\Column]
  17.     #[Groups(['json'])]
  18.     private ?int $id null;
  19.     #[ORM\Column(length100nullabletrue)]
  20.     #[Assert\Length(max100)]
  21.     private ?string $name null;
  22.     #[ORM\ManyToOne(inversedBy'provinces')]
  23.     private ?Country $country null;
  24.     
  25.     public function __toString()
  26.     {
  27.         return $this->name;
  28.     }
  29.     public function getId(): ?int
  30.     {
  31.         return $this->id;
  32.     }
  33.     public function getName(): ?string
  34.     {
  35.         return $this->name;
  36.     }
  37.     public function setName(?string $name): self
  38.     {
  39.         $this->name $name;
  40.         return $this;
  41.     }
  42.     public function getCountry(): ?Country
  43.     {
  44.         return $this->country;
  45.     }
  46.     public function setCountry(?Country $country): self
  47.     {
  48.         $this->country $country;
  49.         return $this;
  50.     }
  51. }