-
Notifications
You must be signed in to change notification settings - Fork 29
Support optional parameters in routes. #110
Comments
I think this should be easy enough to implement. However -- are your Pages Documents? Or properties on your Article document? If your pages are indeed documents, why not map the auto routing to the pages instead? |
For the moment, I didn't choose a final solution. I'm still thinking of it. Which case you would recommend? I think pages shouldn't be documents (nodes). This is because editor in CMS might want to have possibility to easilt modify a content of many pages. E.g. move one part (paragraph) from one page to another. |
I would be tempted to make the "elements" children of the article as you suggest and then map the auto routing to those child elements. This would make the most sense from a routing point of view I think. So
Where btw, If you want to try out the new version of routing auto it would be really helpful, as we want to release it soon :) The docs are in this PR: https://github.com/symfony-cmf/symfony-cmf-docs/pull/511/files |
Thanks a lot! Yes, I think this makes the most sense in content-repository world. (I just still think in a relation-db way). Then, the other Page elements (paragraphs [p], images [img], and the other formatting things) could be just then child-nodes of the Page, but without being involved in a Route Objects (because they are not separate things, but relate to a Page only). Thanks for docs reference. I can see that quite much change, like config labels (no more existing/non-exiting actions...?). |
No, no more non-existing actions. If there exists something at the destination we use a "conflict resolver" (i.e. auto increment). But the biggest plus is the redirect routes - when you change the name of an article (for example) the old route can be turned into a redirect to the new route, which is great for SEO :) It does require the bleeding edge version of PHPCR-ODM however.. |
Yes, the thing with changing articles names was one of those SEO specialist recently mentioned. Nice feature. |
One more question: is Routing Auto able to manage / respond to domain names? |
No, currently that feature is not implemented. |
Can I leave a request for it? It's quite often used, e.g. for blog.domain.com etc. |
Yeah you can .. but given the use case you provided you would be better to route based on the domain + the uri, and not just the uri on its own. e.g. it would be better to treat I'm not sure what the status of domain based routing is, @dbu? If that functionality exists, or if we create it, then we can support it in RoutingAuto |
@dbu busy I guess. I found his answer at stack overflow: http://stackoverflow.com/questions/23744815/how-to-add-a-phpcr-odm-referencemany-field-to-sonata-admin Now I'm at the stage where I can add children (i.e. pages) to the Article from within Sonata Admin - thanks to the code example in Block Bundle as suggested by dbu (otherwise I'm not sure if I was able to do this - it seems there's no much documentation on Sonata's PHPCR, isn't it?). Now, Routing Auto creates a route for Article, but it doesn't for Pages. In fact, I don't need separate routes for pages. I think having routes for pages of an article is pointless - since they're just numbers (e.g. category/article-title/3 - for page 3 of the article), and problematical (the information of the page number would be doubled up then - i.e. in the page Document, and in the corresponding route object). So I decided that probably the best way is to use optional parameter ({$page}), and pass it to the controller. So the present request for the parameters feature is that they could be optional, and if not provided in the url, then e.g. the one from controller's is used. Example of the controller's action's definition - it could look like the following: public function indexAction($contentDocument, $page = 1) For the url: category/article/{page} |
hm, i thought i had answered here, sorry. anyways, if your route document has a requirement on the domain, it will be taken into account. @benglass was working a lot on multidomain. we made it possible for RoutingBundle to pull in routes from different roots (e.g. a domain specific root and a default root shared for all domains). you can build on that, but maybe ben has some more input? |
This feature is the most important one I think, since it allows to have a nice paginator feature with PHPCR nodes and Route Auto bundle. Would it be possible to have it implemented in the closest S CMF release? (If not, please let me know, I will then try to find some workaround for now). |
well, we have just released 1.0.0 (like 2 hours ago). So the next release isn't going to be very soon. But you can easily implement the solution we come up with here in your app and remove it when we release next. @dbu @lsmith77 @wouterj ftr - what is the policy with non BC-breaking feature additions? Should they be in the major release cycle? |
new features will go into the next minor release, aka RoutingAutoBundle 1.1 |
if we have enough interesting features, i see no problem releasing 1.1
http://semver.org/ says a minor version (aka 1.1) can have new features |
Opened #152 which is more to the point as this issue is quite long and confusing now. |
According to a SEO specialist I work with (and we want to build our CMS with use of CMF), there is a need to use parameters in routes, which are no routes themselves, but only used in controllers.
Normally, Routing-Auto-Bundle creates a routes built up from "path-unit", e.g.:
domnain.com/category/article
could correspond to /routes/cms/category/article Rout object.
With parameters however, there is a need to add some information to a controller in a way that was easily achieved in standard Symfony2 - when paramters are passed to a controller, e.g.:
domain.com/category/article/{page}
This is a basic example. But perhaps some might need also different cases, like:
domnain.com/{category}/article/{page}
where both category and page are just paramters - variables passed to a controller. (Is it possible in Content Repository based routes? I hope it is...).
Perhaps more sophisticated things are also possible? Example:
domain/category[-]{theme}/article[-p]{page}
i.e.
Route is: /routes/cms/category/article
And the pattern for a route is: domain/category-.../article-p...
"..." respond to a parameter, so finally in this case controller would get $theme and $page variables.
But at the moment the most important is the first case (the one with {page} at the end of an url), if the others are too complex.
The text was updated successfully, but these errors were encountered: