Skip to content

Instantly share code, notes, and snippets.

View syther101's full-sized avatar

Ryan syther101

View GitHub Profile
@syther101
syther101 / ExceptionListener.php
Last active June 29, 2018 14:39
Symfony 3 API. Returning form errors as json
<?php
namespace AppBundle\Event\Listener;
use AppBundle\Exception\ValidationException;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent;