Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update fosrestbundle-integration.md #1083

Closed
wants to merge 1 commit into from
Closed

Update fosrestbundle-integration.md #1083

wants to merge 1 commit into from

Conversation

yun548
Copy link

@yun548 yun548 commented Apr 12, 2016

No description provided.

@javiereguiluz
Copy link
Collaborator

@Yunyun548 thanks for proposing this improvement. I don't use FOSRestBundle, so I investigated its documentation a bit and I found this.

What do you think about changing the current doc by the following?

# app/config/config.yml
fos_rest:
    format_listener:
        enabled: true
        rules:
            - { path: '^/admin', methods: ['GET', 'POST'], priorities: ['html'],
                fallback_format: 'html', prefer_extension: false }
            - { path: '^/', stop: true }

@ogizanagi
Copy link
Contributor

@javiereguiluz : Actually, shouldn't it even be something like:

# app/config/config.yml
fos_rest:
    format_listener:
        enabled: true
        rules:
            # [...] previous rules declarations
            - { path: '^/admin', stop: true }

or exactly as shown in the docs, disable format listener on anything non api-related:

# app/config/config.yml
fos_rest:
    format_listener:
        enabled: true
        rules:
            - { path: '^/api', priorities: ['json', 'xml'], ... } # or any other rule needing the format listener
            - { path: '^/', stop: true }

?

We should also add a link to this section.

@javiereguiluz
Copy link
Collaborator

@ogizanagi I understand it exactly the opposite: we need the format listener for the EasyAdmin routes and then we use stop for the rest of routes to not interfere with them.

Let's ask @xabbuh because he has a lot of experience with FOSRestBundle. Thanks!

@xabbuh
Copy link
Collaborator

xabbuh commented Apr 12, 2016

@ogizanagi's approach looks like a good solution to me (you do not define an API related controllers in EasyAdminBundle if I am not mistaken so there's no need to dynamically determine the format). For FOSRestBundle 2.0, you may also point the reader to the documentation of the zones configuration (at the bottom of the page).

@javiereguiluz
Copy link
Collaborator

@Yunyun548 I'm closing this in favor of #1085, which finishes it. I've reused your commit so you'll get full credit for your work. Thanks!

javiereguiluz added a commit that referenced this pull request Apr 15, 2016
…yun548, javiereguiluz)

This PR was merged into the master branch.

Discussion
----------

Updated the tutorial about FOSRestBundle integration

This finishes #1083 with the comments provided by @ogizanagi and @xabbuh.

Commits
-------

d391975 Reworded the article
a4d5b45 Update fosrestbundle-integration.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants