src/Entity/Continent.php line 12

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\ContinentRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
  6. use Symfony\Component\Validator\Constraints as Assert;
  7. #[ORM\Entity(repositoryClassContinentRepository::class)]
  8. #[UniqueEntity('name')]
  9. class Continent //implements Translatable
  10. {
  11.     #[ORM\Id]
  12.     #[ORM\GeneratedValue]
  13.     #[ORM\Column(type'integer')]
  14.     private $id;
  15.     #[ORM\Column(name'name'type'string'length50)]
  16.     #[Assert\NotBlank]
  17.     #[Assert\Length(min3max50)]
  18.     #[Assert\Regex(
  19.         pattern'/^[\p{L}\p{M}\s\'-]+$/u',
  20.     )]
  21.     private ?string $name;
  22.     #[ORM\Column(type'boolean')]
  23.     private bool $active;
  24.     public function __construct(){}
  25.     public function getId()
  26.     {
  27.         return $this->id;
  28.     }
  29.     public function getName(): string
  30.     {
  31.         return $this->name;
  32.     }
  33.     public function setName(?string $name): self
  34.     {
  35.         $this->name $name;
  36.         return $this;
  37.     }
  38.     public function isActive(): ?bool
  39.     {
  40.         return $this->active;
  41.     }
  42.     public function setActive(bool $active): self
  43.     {
  44.         $this->active $active;
  45.         return $this;
  46.     }
  47.     public function __toString(): string
  48.     {
  49.         return $this->name;
  50.     }
  51. }