This commit is contained in:
parent
d892ffed34
commit
502a5d5bda
@ -1,17 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Controller;
|
|
||||||
|
|
||||||
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
use Symfony\Component\Routing\Attribute\Route;
|
|
||||||
|
|
||||||
class test extends AbstractController
|
|
||||||
{
|
|
||||||
#[Route(path: '/test', name: 'app_test', methods: Request::METHOD_GET)]
|
|
||||||
public function test(): Response
|
|
||||||
{
|
|
||||||
return new Response('test');
|
|
||||||
}
|
|
||||||
}
|
|
22
src/test.php
22
src/test.php
@ -1,22 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App;
|
|
||||||
|
|
||||||
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
|
|
||||||
use Symfony\Component\HttpFoundation\Response;
|
|
||||||
use Symfony\Component\HttpKernel\Event\ExceptionEvent;
|
|
||||||
use Symfony\Component\HttpKernel\KernelEvents;
|
|
||||||
|
|
||||||
class test implements EventSubscriberInterface
|
|
||||||
{
|
|
||||||
|
|
||||||
public static function getSubscribedEvents()
|
|
||||||
{
|
|
||||||
return [KernelEvents::EXCEPTION => 'onKernelException'];
|
|
||||||
}
|
|
||||||
|
|
||||||
public function onKernelException(ExceptionEvent $event)
|
|
||||||
{
|
|
||||||
$event->setResponse(new Response('test'));
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user