-
Notifications
You must be signed in to change notification settings - Fork 94
create a RestBundle that creates routes to any content on the fly #180
Comments
I think we should go a way sonta admin (phpcr) goes for the routing. We would have the document path as an id and can work on it. |
Is this addressed by: https://github.com/symfony-cmf/ResourceRestBundle ? |
well we have two things to cover here imho:
From what I have gathered so far the ResourceRestBundle only covers 1) but not (yet) 2) |
the Resource REST API will embed the PHPCR-ODM documents, and serializes them using the Hateoas serializer. This means that you can map For example: {
"path": "/resource/path"
"document": {
"_links": {
"url": {
"/url/to/this/content"
},
"html_edit": {
"/admin/edit/1234"
},
"html_view": {
"/admin/view/1234"
},
},
"title": "Foobar"
"children": {
// ...
}
} /**
* @Hateaos\Relation("url", "route(object)")
* ...
*/
class Article
{
} |
yes .. but take for example a path like |
have you got an example of the request / response you would want? |
ContentBundle inside the Sandbox example:
|
BTW I just checked the CreateBundle and there it seems we are currently using the actual repository paths inside the RDFa, which means there we will not need anything special:
|
ok i understand now. I wonder if it should be in the scope of the I also wonder if we should make the ResourceRestBundle simply RestBundle and increase its scope (we basically delegate most things to BazingaHateoasBundle and JMSSerializer for all the technical stuff anyway). |
Yeah, I am not sure if its within the scope or not. Depends on what it takes to implement it. Essentially the difference to me is that we have to go through the entire standard routing system and not a special end point that ensures we go through a specific controller. What I could imagine is a listener that re-writes the Controller for specific output formats after the routing is finished. |
It would be really easy if we just use the Hateoas serializer to serialize the |
A question would be: what about POST requests? this would mean a new content on a new route, so the RouteProvider would not be able to guess a controller as the route is unknown. |
(unfortunatly posted in ContentBundle issue): I think i would have a first suggestion: RestBundle The ideas are:
Note: Edit: |
essentially it ships a RouteProvider that can dynamically create a route for any content in the repository along with a controller that can handle all the different HTTP verbs. this might eventually also replace the JSON-LD enabled controller in CreateBundle.
this is somewhat related to symfony-cmf/content-bundle#93 however this ticket is about providing REST read support for content that is exposed via explicit routes.
maybe some inspiration can be taken from the Magnolia 5.2 REST Module:
http://documentation.magnolia-cms.com/display/DEV/Concept+REST+module
The text was updated successfully, but these errors were encountered: