
Returning custom headers with FOSRestBundle
The Content-Range header supports a (dgrid) OnDemandGrid
use FOS\RestBundle\View\View as FOSRestView;
...
$view = FOSRestView::create();
$view->setData($data);
$view->setHeader( 'Content-Range', 'items '.$offset.'-'.($offset+$limit).'/'.$count);
$handler = $this->get('fos_rest.view_handler');
return $handler->handle($view);
Ref: https://symfony.com/doc/1.5/bundles/FOSRestBundle/2-the-view-layer.html
Symfony 4
Print article | This entry was posted by elvis on 06/27/18 at 05:19:00 am . Follow any responses to this post through RSS 2.0. |