From a4d5b4558a9d45d6c038dd98dc6eb343514b7626 Mon Sep 17 00:00:00 2001 From: Jordi Fernandez Date: Tue, 12 Apr 2016 16:31:02 +0200 Subject: [PATCH 1/2] Update fosrestbundle-integration.md --- Resources/doc/tutorials/fosrestbundle-integration.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Resources/doc/tutorials/fosrestbundle-integration.md b/Resources/doc/tutorials/fosrestbundle-integration.md index fa88aa68ed..710d9778c9 100644 --- a/Resources/doc/tutorials/fosrestbundle-integration.md +++ b/Resources/doc/tutorials/fosrestbundle-integration.md @@ -25,10 +25,9 @@ the `path` option if your backend customized the URL prefix): # app/config/config.yml fos_rest: format_listener: - enabled: true + enabled: false # Can be removed since it's the default configuration. If set to true it'll break responses on your others routes or you will have to specify a return type for your other routes. rules: - - { path: '^/admin', methods: ['GET', 'POST'], priorities: ['html'], - fallback_format: 'html', prefer_extension: false } + - { path: '^/admin', methods: ['GET', 'POST'], priorities: ['html'], fallback_format: 'html', prefer_extension: false } ``` [1]: https://github.com/FriendsOfSymfony/FOSRestBundle From d3919751afe0ea3f3ab10f7b1461297872c3b498 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Tue, 12 Apr 2016 21:38:34 +0200 Subject: [PATCH 2/2] Reworded the article --- .../tutorials/fosrestbundle-integration.md | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/Resources/doc/tutorials/fosrestbundle-integration.md b/Resources/doc/tutorials/fosrestbundle-integration.md index 710d9778c9..3d9ec4196c 100644 --- a/Resources/doc/tutorials/fosrestbundle-integration.md +++ b/Resources/doc/tutorials/fosrestbundle-integration.md @@ -13,21 +13,20 @@ This listener provided by FOSRestBundle determines the best format for the request based on the HTTP Accept header included in the request and some format priority configuration. -Since EasyAdmin doesn't define the format of the request, it's recommended to -define this format for all the backend URLs using the FOSRestBundle -configuration. +If you have enabled this format listener, disable it for the backend routes: -Open your main configuration file, look for the `fos_rest` configuration block -and add the following `format_listener` configuration (change the value of -the `path` option if your backend customized the URL prefix): - -```yaml +``` # app/config/config.yml fos_rest: format_listener: - enabled: false # Can be removed since it's the default configuration. If set to true it'll break responses on your others routes or you will have to specify a return type for your other routes. + enabled: true rules: - - { path: '^/admin', methods: ['GET', 'POST'], priorities: ['html'], fallback_format: 'html', prefer_extension: false } + # ... previous rules declarations + - { path: '^/admin', stop: true } # <-- add this line ``` +When using FOSRestBundle 2.0, you may also need to configure the "zones" as +explained in [this chapter][2] of the FOSRestBundle documentation. + [1]: https://github.com/FriendsOfSymfony/FOSRestBundle +[2]: http://symfony.com/doc/master/bundles/FOSRestBundle/3-listener-support.html