src/Domain/Entity/Config.php line 27

Open in your IDE?
  1. <?php
  2. declare(strict_types=1);
  3. namespace App\Domain\Entity;
  4. use ApiPlatform\Metadata\ApiProperty;
  5. use ApiPlatform\Metadata\ApiResource;
  6. use ApiPlatform\Metadata\Delete;
  7. use ApiPlatform\Metadata\Get;
  8. use ApiPlatform\Metadata\GetCollection;
  9. use ApiPlatform\Metadata\Post;
  10. use ApiPlatform\Metadata\Put;
  11. #[ApiResource(
  12.     operations: [
  13.         new Delete(security"is_granted('ROLE_ADMIN')"),
  14.         new GetCollection(),
  15.         new Get(),
  16.         new Post(security"is_granted('ROLE_ADMIN')"),
  17.         new Put(security"is_granted('ROLE_ADMIN')"),
  18.     ],
  19.     normalizationContext: ['groups' => ['config_read']],
  20.     denormalizationContext: ['groups' => ['config_write']],
  21.     order: ['name' => 'ASC'],
  22. )]
  23. class Config
  24. {
  25.     #[ApiProperty(identifiertrue)]
  26.     public ?int $id null;
  27.     public function __construct(
  28.         public string $name,
  29.         public string $value,
  30.     ) {
  31.     }
  32. }