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
[Routing] Allow to import multiple resources #2145
Conversation
just as a quick background the aim is to be able to configure multiple resources to handle API versioning: FriendsOfSymfony/FOSRestBundle#12 |
|
||
if (isset($config['resources'])) { | ||
$config['resources'] = (array) $config['resources']; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't it be done before parsing the resources ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh sorry, I missed the fact it is a method called before the other change.
Which problem does it solve? What's the difference between:
and:
|
the point is that this way we can easily define a relation between the resources. in our particular use case the relation is that there is a set of controller classes/services that all are providing different versions of the same API. |
You can define a relation by adding a special option:
Routing is about parsing the URL and converting it into parameters. Your request is about something different, which does not belong to the Routing. |
Sure thats possible and we have already considered this: Its just that things will be easier and cleaner with the support for resources. I do not think that my request is about anything different than route generation, but sure it can be considered syntactical sugar to some extend. |
Now that a resource can have some |
I will try to play with this all over the weekend. I went back and forth with lots of design ideas and I don't have a perfect overview in my head anymore what I need specifically. I do remember that I realized that I really need to do the matching inside the Router. I don't remember if that makes this PR no longer necessary for that particular use case. |
@lsmith77: any update on this PR? Is it still needed for you? |
sorry .. no. i didn't get to it last weekend and this weekend i am off. so probably not until christmas so i guess it will not be relevant for 2.1 after all. hopefully when i do work on i will discover that its no longer needed :) |
@lsmith77: any news in this PR? |
no sorry. i have been so busy with PHPCR, that i havent found any time to work on bigger improvements in FOSRestBundle. On 22.01.2012, at 10:46, Fabien Potencier reply@reply.github.com wrote:
|
Closing this PR as I don't think that we can assume that all resources can share the same requirements and defaults. |
This change has been requested by @lsmith77 and @merk for the FosRestBundle.
Multiple resources can be imported at once, see xml and yml examples in the tests.
(The xml files is probably not the best example as you would probably remove the attribute and use child nodes only when importing multiple resources - being able to use both is required to keep BC).
This change is BC.