src/Rest/Traits/Actions/Anon/UpdateAction.php
<?php
declare(strict_types = 1);
/**
* /src/Rest/Traits/Actions/Anon/UpdateAction.php
*
* @author TLe, Tarmo Leppänen <tarmo.leppanen@pinja.com>
*/
namespace App\Rest\Traits\Actions\Anon;
use App\DTO\RestDtoInterface;
use App\Rest\Traits\Methods\UpdateMethod;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Attribute\Route;
use Symfony\Component\Routing\Requirement\Requirement;
use Throwable;
/**
* Trait to add 'updateAction' for REST controllers for anonymous users.
*
* @see \App\Rest\Traits\Methods\UpdateMethod for detailed documents.
*
* @package App\Rest\Traits\Actions\Anon
* @author TLe, Tarmo Leppänen <tarmo.leppanen@pinja.com>
*/
trait UpdateAction
{
use UpdateMethod;
/**
* @throws Throwable
*/
#[Route(
path: '/{id}',
requirements: [
'id' => Requirement::UUID_V1,
],
methods: [Request::METHOD_PUT],
)]
public function updateAction(Request $request, RestDtoInterface $restDto, string $id): Response
{
return $this->updateMethod($request, $restDto, $id);
}
}