-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
[Book][Routing] Add example about how to match multiple methods #5201
Conversation
xelaris
commented
Apr 21, 2015
Q | A |
---|---|
Doc fix? | no |
New docs? | yes |
Applies to | 2.3+ |
Fixed tickets |
I like this, but I'd actually like to solve it in an easier way: add a commented-out example in the previous section: contact_process:
path: /contact
defaults: { _controller: AppBundle:Main:processContact }
methods: [POST]
# or to match GET *or* POST methods
# methods: [GET, POST] What do you think @xelaris? |
I usually prefer concise explanations, as proposed by @weaverryan. But in this case, I think it could be better to show a verbose explanation as proposed by @xelaris. Adding a comment is not clear enough for me. Let's ask @xabbuh and @wouterj for their opinion about this. Thanks. |
I would have said that the example proposed by @weaverryan would be clear enough. @javiereguiluz Do you think from your experience about talking with beginners that this is something not so obvious (even with commented out example)? |
@xabbuh I don't know which would be the opinion of newcomers. It was just a personal comment. Let me show you a pair of screenshots explainig why I said that. We have this: And Ryan proposes to add a comment: It's not a bad idea at all. But my concern is ... what would happen with the other 3 config formats? For example, consider the case of "annotations": Before: After: But I think we could find a solution: what if we use |
I hadn't thought about the annotations format, so I agree with Javier. But making the process handle get or post might be confusing since it has the same URL as the above, and so will never match in GET. I'm in favor of actually merging as is, after making all this fuss (the additions actually small - mostly code block). |
What about using |
Oh, that's a cool idea - I can't believe I didn't think of that! +1 for making the previous example use Post and Put instead of this new section. @xelaris can you make that change? Thanks! |
Oh yeah, that's indeed a great idea @wouterj. |
6f854f9
to
29dbb8d
Compare
I like the idea of changing the existing example to demonstrate how to match multiple methods and I changed the PR as suggested by @wouterj. But I have two points about the current state of this PR:
I'm +1 with @javiereguiluz suggestion to change the What are your opinion about this? |
@xelaris Good point with the best practices. But wouldn't we then don't have an example with only one allowed method when choosing your solution? |
@xabbuh The |
Good point, looks like a good idea then. |
29dbb8d
to
c1e8453
Compare
I have changed the PR to apply the latest proposal. What do you think about it? |
👍 from me |
LOVE it. Thanks @xelaris - you rock for your patience and ideas! |
… methods (xelaris) This PR was merged into the 2.3 branch. Discussion ---------- [Book][Routing] Add example about how to match multiple methods | Q | A | ------------- | --- | Doc fix? | no | New docs? | yes | Applies to | 2.3+ | Fixed tickets | Commits ------- c1e8453 [Book][Routing] Change example to match multiple methods