Skip to content

Commit

Permalink
minor #973 Added a mini-tutorial about FOSRestBundle and EasyAdmin in…
Browse files Browse the repository at this point in the history
…tegration (javiereguiluz)

This PR was merged into the master branch.

Discussion
----------

Added a mini-tutorial about FOSRestBundle and EasyAdmin integration

This fixes #955.

Commits
-------

71f2b82 Added a mini-tutorial about FOSRestBundle and EasyAdmin integration
  • Loading branch information
javiereguiluz committed Mar 10, 2016
2 parents f5c9ed7 + 71f2b82 commit 29f042e
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ read before using EasyAdmin.
* [How to define custom options for entity properties](Resources/doc/tutorials/custom-property-options.md)
* [How to use a WYSIWYG editor](Resources/doc/tutorials/wysiwyg-editor.md)
* [How to upload files and images](Resources/doc/tutorials/upload-files-and-images.md)
* [How To integrate FOSRestBundle and EasyAdmin](Resources/doc/tutorials/fosrestbundle-integration.md)
* [How to manage configuration for complex backends](Resources/doc/tutorials/complex-backend-config.md)
* [Tips and tricks](Resources/doc/tutorials/tips-and-tricks.md)

Expand Down
34 changes: 34 additions & 0 deletions Resources/doc/tutorials/fosrestbundle-integration.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
How To Integrate FOSRestBundle and EasyAdmin
============================================

[FOSRestBundle][1] provides various tools to rapidly develop RESTful APIs in
Symfony applications. EasyAdmin doesn't integrate with FOSRestBundle features in
any way, but there are some options that you may need to configure to avoid
errors in backend URLs.

Format Listener
---------------

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.

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: true
rules:
- { path: '^/admin', methods: ['GET', 'POST'], priorities: ['html'],
fallback_format: 'html', prefer_extension: false }
```

[1]: https://github.com/FriendsOfSymfony/FOSRestBundle

0 comments on commit 29f042e

Please sign in to comment.