<?php
declare(strict_types=1);
namespace App\Domain\Entity;
use ApiPlatform\Metadata\ApiProperty;
use ApiPlatform\Metadata\ApiResource;
use ApiPlatform\Metadata\Delete;
use ApiPlatform\Metadata\Get;
use ApiPlatform\Metadata\GetCollection;
use ApiPlatform\Metadata\Post;
use ApiPlatform\Metadata\Put;
#[ApiResource(
operations: [
new Delete(security: "is_granted('ROLE_ADMIN')"),
new GetCollection(),
new Get(),
new Post(security: "is_granted('ROLE_ADMIN')"),
new Put(security: "is_granted('ROLE_ADMIN')"),
],
normalizationContext: ['groups' => ['config_read']],
denormalizationContext: ['groups' => ['config_write']],
order: ['name' => 'ASC'],
)]
class Config
{
#[ApiProperty(identifier: true)]
public ?int $id = null;
public function __construct(
public string $name,
public string $value,
) {
}
}