for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types = 1);
/**
* /src/Rest/Traits/Actions/User/PatchAction.php
*
* @author TLe, Tarmo Leppänen <[email protected]>
*/
namespace App\Rest\Traits\Actions\User;
use App\DTO\RestDtoInterface;
use App\Enum\Role;
use App\Rest\Traits\Methods\PatchMethod;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
use Symfony\Component\Routing\Requirement\Requirement;
use Symfony\Component\Security\Http\Attribute\IsGranted;
use Throwable;
* Trait PatchAction
* Trait to add 'patchAction' for REST controllers for 'ROLE_USER' users.
* @see \App\Rest\Traits\Methods\PatchMethod for detailed documents.
* @package App\Rest\Traits\Actions\Root
trait PatchAction
{
use PatchMethod;
* @throws Throwable
#[Route(
path: '/{id}',
requirements: [
'id' => Requirement::UUID_V1,
],
methods: [Request::METHOD_PATCH],
)]
#[IsGranted(Role::USER->value)]
public function patchAction(Request $request, RestDtoInterface $restDto, string $id): Response
return $this->patchMethod($request, $restDto, $id);
}