src/Entity/Country.php line 22

Open in your IDE?
  1. <?php
  2. namespace App\Entity;
  3. use App\Repository\CountryRepository;
  4. use Doctrine\ORM\Mapping as ORM;
  5. #[ORM\Entity(repositoryClassCountryRepository::class)]
  6. class Country implements \JsonSerializable
  7. {
  8.     #[ORM\Id]
  9.     #[ORM\GeneratedValue]
  10.     #[ORM\Column]
  11.     private $id;
  12.     #[ORM\Column(length300)]
  13.     private $value;
  14.     #[ORM\Column(type'boolean',nullable:trueoptions: ['default' => true])]
  15.     private $state true;
  16.     public function jsonSerialize()
  17.     {
  18.         return [
  19.             'id' => $this->getId(),
  20.             'value' => $this->getValue(),
  21.         ];
  22.     }
  23.     public function getId(): ?int
  24.     {
  25.         return $this->id;
  26.     }
  27.     public function getValue(): ?string
  28.     {
  29.         return $this->value;
  30.     }
  31.     public function setValue(string $value): static
  32.     {
  33.         $this->value $value;
  34.         return $this;
  35.     }
  36.     public function getState()
  37.     {
  38.         return $this->state;
  39.     }
  40.     public function setState($state): self
  41.     {
  42.         $this->state $state;
  43.         return $this;
  44.     }
  45.     
  46.     public function getStringState()
  47.     {
  48.         if($this->getState()){
  49.             return "Activé";
  50.         };
  51.         return "Bloqué";
  52.     }
  53.     public function isState(): ?bool
  54.     {
  55.         return $this->state;
  56.     }
  57.     
  58. }