-
Notifications
You must be signed in to change notification settings - Fork 703
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
moved upgrading hints and expanded them
- Loading branch information
Showing
2 changed files
with
48 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
Upgrading | ||
========= | ||
|
||
Note as FOSRestBundle is not yet declared stable, this document will only be updated | ||
for major refactorings. | ||
|
||
### upgrading from 0.5.0_old_serializer | ||
|
||
* In case you are using th SensioFrameworkExtra integration you must change | ||
sensio_framework_extra setting: | ||
|
||
sensio_framework_extra: | ||
view: { annotations: true } | ||
|
||
* The ViewInterface is gone so you might have to change your controller config if you refer to the fos_rest.view service. | ||
|
||
* The View class is now split into a View (simple data container) and a ViewHandler (contains the actual rendering logic). | ||
|
||
The following code would need to be changed: | ||
|
||
public function indexAction($name = null) | ||
{ | ||
$view = $this->container->get('fos_rest.view'); | ||
|
||
if (!$name) { | ||
$view->setResourceRoute('_welcome'); | ||
} else { | ||
$view->setParameters(array('name' => $name)); | ||
$view->setTemplate(new TemplateReference('LiipHelloBundle', 'Hello', 'index')); | ||
} | ||
|
||
return $view->handle(); | ||
} | ||
|
||
To the following code: | ||
|
||
public function indexAction($name = null) | ||
{ | ||
if (!$name) { | ||
$view = RouteRedirectView::create('_welcome'); | ||
} else { | ||
$view = View::Create(array('name' => $name)) | ||
This comment has been minimized.
Sorry, something went wrong. |
||
->setTemplate(new TemplateReference('LiipHelloBundle', 'Hello', 'index')); | ||
; | ||
} | ||
|
||
return $this->container->get('fos_rest.view_handler')->handle($view); | ||
} |
you should add the use statements for these classes