Namespace..  nice idea. ;-)

As of symfony 1.2 we can put routes who belong to a "object" (for
example "article") into a sfObjectRouteCollection [1] or such a class.
So this can be seen as kind of "namespace".

In fact the new admin generator uses this concept to provide/use
routes for all the actions of an admin module.

regards,
Matthias

[1] 
http://trac.symfony-project.org/browser/branches/1.2/lib/routing/sfObjectRouteCollection.class.php


On 25 Nov., 12:57, Fabian Spillner <[EMAIL PROTECTED]> wrote:
> Your idea is very great – it makes sense only on huge projects with a
> lot of routing definitions.
>
> One important thing: it should be good readable and easy to understand
> the configuration rules.
>
> Ex.:
>
> routing.yml
>
> article_base:
>   url:     /article
>   class:   sfGotoRoute
>   options: { route: article }
>
> routing/article.yml:
>
> article_show:
>   url:     /:id/:slug
>   param:   { module: article, action: show }
>   class:   sfPropelRoute
>   options: { model: Article, type: object }
>
> article_add:
>   url:     /add
>   ...
>
> It sounds really good, but the problem is overview of defined route
> names.
> I dont want to check in every route file if there is a route with same
> name defined.
>
> The problem could be solved by given namespace like:
>
> url_for('@article:show?id=123&slug=foobar');
>
> And in my routing/article.yml:
>
> show:
>   url: ...
>
> add:
>   url: ...
>
> in routing.yml:
>
> routing.yml
>
> article:
>   url:     /article
>   class:   sfGotoRoute
>   options: { route: article }
>
> Now it seems not be clean and compatible with actual routing syntax:
> what´s the namespace, what´s not!
>
> The cleanest way is to define namespaces in routing.yml like:
>
> sf_route_namespaces:
>   article:
>     url:    /article
>     route:  article
>   ...
>
> my_route:
>   url:   /
>   ...
>
> It needs more change to get the chance to be a part of symfony
> core :-)
>
> On Nov 24, 11:41 am, Olivier Poitrey <[EMAIL PROTECTED]> wrote:
>
> > About legibility, I don't advise to use sfJump directly, it's just an
> > underlaying tool for sfPatternSubRouting to do the grouping job. If
> > you use the splitted files feature of sfPatternSubRouting, I would
> > tend to say your big routing file will be more maintainable.
>
> > About the perf, I've no numbers yet. I developed those patches the day
> > I posted the mail last week, thus it's not yet tested in production.
> > It's more a request for comment than a stable and finalized code :)
>
> > On 24 nov. 08, at 07:47, naholyr wrote:
>
> > > But in your case, you may have watched the times displayed in the
> > > debug bar for the routing part. What was your gain ?
>
> > > About the readability ? It's kinda smart having used the system for
> > > those "utility" rules (especially the sfRewrite one, and the
> > > subrouting idea) but is the routing.yml still maintainable and
> > > parsable by humans ? With all that jumps and gotos :s
>
> > > On Nov 21, 8:29 am, Olivier Poitrey <[EMAIL PROTECTED]> wrote:
> > > > On 21 nov. 08, at 14:11, Kiril Angov wrote:
>
> > > > > I want to ask first, is the performance gain noticeable?
>
> > > > It completely depends on your routing configuration actually. If you
> > > > have only a few routes with very simple patterns, I would say no. If
> > > > you have one hundred routes with some very complex patterns, the
> > > > performance gain can be high.
>
> > > > --
> > > > Olivier Poitrey
>
> > --
> > Olivier Poitrey
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"symfony developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/symfony-devs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to