You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
1.1KB

  1. <?php
  2. namespace Lc\SovBundle\EventListener;
  3. use Symfony\Component\HttpFoundation\Session\SessionInterface;
  4. use Symfony\Component\HttpKernel\Event\ExceptionEvent;
  5. use Symfony\Component\HttpKernel\Exception\HttpExceptionInterface;
  6. class ExceptionListener
  7. {
  8. /*public function __construct(
  9. SessionInterface $session
  10. ) {
  11. $this->session = $session;
  12. }*/
  13. public function onKernelException(ExceptionEvent $event)
  14. {
  15. // You get the exception object from the received event
  16. $exception = $event->getThrowable();
  17. // @TODO : à retester et éventuellement remettre en place
  18. // On détecte une erreur interne (500), on remove les sessions qui servent de filtre dans l'admin
  19. /*if ($exception instanceof HttpExceptionInterface != true) {
  20. if (!headers_sent()) {
  21. foreach ($this->session->all() as $key => $s) {
  22. if (str_contains($key, "_filter")) {
  23. $this->session->remove($key);
  24. }
  25. }
  26. }
  27. }*/
  28. }
  29. }