Skip to content

Commit

Permalink
Using View::create instead of $this->view
Browse files Browse the repository at this point in the history
Using View::create instead of $this->view cause $this->view is not always available
  • Loading branch information
Genar Trias Ortiz committed Jul 7, 2015
1 parent d14f7ee commit 38d31c1
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Resources/doc/view_response_listener.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,18 @@ you should return a ``$view`` object with the data set by ``setTemplateData``.
<?php
use FOS\RestBundle\View\View;
/**
* @View()
*/
public function getUsersAction()
{
$view = View::create();
// ...
$view = $this->view($data, 200)
$view
->setData($data)
->setTemplateData($templateData)
;
return $view;
Expand Down

0 comments on commit 38d31c1

Please sign in to comment.