src/Ship/Entities/LocaleEntity.php line 43

Open in your IDE?
  1. <?php
  2. namespace App\Ship\Entities;
  3. use ApiPlatform\Metadata\ApiResource;
  4. use ApiPlatform\Metadata\Delete;
  5. use ApiPlatform\Metadata\Post;
  6. use ApiPlatform\Metadata\Get;
  7. use ApiPlatform\Metadata\GetCollection;
  8. use ApiPlatform\Metadata\Put;
  9. use Doctrine\DBAL\Types\Types;
  10. use Doctrine\ORM\Mapping as ORM;
  11. use Symfony\Component\Serializer\Annotation\Groups;
  12. use Gedmo\Mapping\Annotation as Gedmo;
  13. #[ApiResource(
  14.     operations: [
  15.         new Get(
  16.             uriTemplate'/locales/{id}'requirements: ['id' => '\d+'],
  17.             security"is_granted('ROLE_ADMIN') or is_granted('ROLE_USER_CLIENT') or is_granted('ROLE_USER_GUEST')"
  18.         ),
  19.         new Post(
  20.             uriTemplate'/locales',
  21.             security"is_granted('ROLE_ADMIN')"
  22.         ),
  23.         new Put(
  24.             uriTemplate'/locales/{id}'requirements: ['id' => '\d+'],
  25.             security"is_granted('ROLE_ADMIN')"
  26.         ),
  27.         new Delete(
  28.             uriTemplate'/locales/{id}'requirements: ['id' => '\d+'],
  29.             security"is_granted('ROLE_ADMIN')"
  30.         ),
  31.         new GetCollection(
  32.             uriTemplate'/locales',
  33.             security"is_granted('ROLE_ADMIN') or is_granted('ROLE_USER_CLIENT') or is_granted('ROLE_USER_GUEST')"
  34.         )
  35.     ],
  36.     shortName'Locales'
  37. )]
  38. #[ORM\Entity()]
  39. #[ORM\Table(name'`system_locales`')]
  40. class LocaleEntity
  41. {
  42.     #[ORM\Id]
  43.     #[ORM\GeneratedValue]
  44.     #[ORM\Column(typeTypes::INTEGER)]
  45.     #[Groups(['read'])]
  46.     private ?int $id null;
  47.     #[ORM\Column(typeTypes::STRINGlength7nullablefalseuniquetrue)]
  48.     #[Groups(['read'])]
  49.     private string $code;
  50.     #[ORM\Column(typeTypes::STRINGlength7nullabletrueuniquetrue)]
  51.     #[Groups(['read'])]
  52.     private ?string $locale null;
  53.     #[ORM\Column(typeTypes::STRINGlength50nullablefalse)]
  54.     #[Groups(['read'])]
  55.     private string $name;
  56.     #[ORM\Column(typeTypes::BOOLEAN)]
  57.     #[Groups(['read'])]
  58.     private ?bool $isDefault false;
  59.     #[Gedmo\Timestampable(on'create')]
  60.     #[ORM\Column(typeTypes::DATETIME_IMMUTABLE)]
  61.     public $createdAt;
  62.     #[Gedmo\Timestampable(on'update')]
  63.     #[ORM\Column(typeTypes::DATETIME_IMMUTABLE)]
  64.     protected $updatedAt;
  65.     
  66.     public function getId()
  67.     {
  68.         return $this->id;
  69.     }
  70.     public function getCode()
  71.     {
  72.         return $this->code;
  73.     }
  74.     public function setCode($code)
  75.     {
  76.         $this->code $code;
  77.         return $this;
  78.     }
  79.     public function getLocale()
  80.     {
  81.         return $this->locale;
  82.     }
  83.     public function setLocale($locale)
  84.     {
  85.         $this->locale $locale;
  86.         return $this;
  87.     }
  88.     public function getName()
  89.     {
  90.         return $this->name;
  91.     }
  92.     public function setName($name)
  93.     {
  94.         $this->name $name;
  95.         return $this;
  96.     }
  97.     public function getIsDefault()
  98.     {
  99.         return $this->isDefault;
  100.     }
  101.     public function setIsDefault($value)
  102.     {
  103.         $this->isDefault $value;
  104.         return $this;
  105.     }
  106. }