Show all projects!

Route Handler - File Templates in PHPStorm verwenden

<?php
#parse("PHP File Header.php")
 
declare(strict_types=1);
 
#if (${NAMESPACE})
namespace ${NAMESPACE};
 
#end
 
use Laminas\Diactoros\Response\RedirectResponse;
use Mezzio\Flash\FlashMessages;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
use Symfony\Component\Routing\Annotation\Route;
 
final class ${NAME} implements RequestHandlerInterface
{
    public function __construct(
    ) {
    }
 
    #[Route(name: 'videorenderserver-delete-scene-template')]
    public function handle(ServerRequestInterface ${DS}request): ResponseInterface
    {
        /** @var FlashMessages ${DS}flashMessages */
        ${DS}flashMessages = ${DS}request->getAttribute('flash');
 
        ${DS}sceneId = (int)${DS}request->getAttribute('sceneId');
        ${DS}parsedBody = (array) ${DS}request->getParsedBody();
${DS}jsonPostData = json_decode((string)${DS}request->getBody(), false, 512, JSON_THROW_ON_ERROR);
        ${DS}flashMessages->flash(
            'sceneDeleted',
            'Scene Template ' . ${DS}sceneId . ' was deleted'
        );
 
        return new RedirectResponse(${DS}this->urlHelper->generate('videorenderserver-scenes-list'));
         
        return new HtmlResponse(
            ${DS}this->template->render(
                '@videorenderserver/preview-scene-card.html.twig',
                [
                    'scene' => ${DS}sceneTemplateEntity,
                    'length' => SceneLengthService::getSceneLengthSettings(${DS}sceneTemplateEntity),
                ]
            )
        );
    }
}

Article relase date: / Last update: