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.

RestApiController.php 646B

1234567891011121314151617181920
  1. <?php
  2. namespace PhpBenchmarksSymfony\RestApiBundle\Controller;
  3. use PhpBenchmarksRestData\Service;
  4. use PhpBenchmarksSymfony\RestApiBundle\EventListener\DefineLocaleEventListener;
  5. use Symfony\Bundle\FrameworkBundle\Controller\Controller;
  6. use Symfony\Component\HttpFoundation\JsonResponse;
  7. use Symfony\Component\HttpFoundation\Response;
  8. class RestApiController extends Controller
  9. {
  10. /** @return Response */
  11. public function restAction()
  12. {
  13. $this->get('event_dispatcher')->dispatch(DefineLocaleEventListener::EVENT_NAME);
  14. return new JsonResponse($this->get('serializer')->normalize(Service::getUsers(), 'json'));
  15. }
  16. }