Ticket #448 (new task)

Opened 21 months ago

Last modified 6 months ago

Rewrite/refactor parts of routing, at least gen()

Reported by: david Owned by: dominik
Priority: high Milestone: 1.0
Component: routing Version:
Severity: major Keywords:
Cc: Patch attached: no

Description

Especially gen() is awfully broken because it had to evolve and change direction numerous times (e.g. #434, #444) - we can rewrite it to make it more maintainable, faster, simpler, etc etc etc etc. Right now, it's more or less a house of cards prone to fall over if we change the most simple things. Maybe we can optimize other aspects while we're at it.

Attachments

agavi_routing_ticket_448_gen_partial_routes.patch (1.4 KB) - added by felix@… 6 months ago.
a partial patch against 0.11 that enables generation of '+rss' style routes

Change History

Changed 11 months ago by david

#630 describes another issue.

Basically, we should refactor the routing so that any necessary encoding/escaping of values is done _afterwards_ by the concrete implementation. In case of the WebRouting?, that'd be rawurlencode().

I had the idea that the returned $path from parent::gen() (which we should rename since the signatures and return values differ) is an object with __toString(), and each of the $usedParams is a reference to the respective chunk in that object. Then, a rawurlencode call can be made afterwards. Also, a chunk could be some AgaviLiteralRoutingFragment or such object, which do not get encoded.

That would even, more or less, maintain BC.

Oh and... the array('AgaviToolkit', 'isNotArray') callback to array_filter is horribly slow; is_numeric does the job ~5 times faster, but is not the same thing of course.

The goal for this routing refactoring should also be that we can allow passing arrays and objects as routing gen args.

Changed 6 months ago by david

  • has_patch unset

More stuff to be done:

  • factor out code from gen() methods
  • allow $ro->gen('+rss') which would generate the current routes plus rss
  • move Routing::gen() to Routing::doGen() so subclasses can overwrite that one independently

Changed 6 months ago by felix@…

a partial patch against 0.11 that enables generation of '+rss' style routes

Changed 6 months ago by felix@…

I noted that the solution for emulation '+rss' style routes that was quoted on irc has some major flaws: It does not honor get params that are not handled by routes, making you loose the query string. That's a bad thing (tm) and so I decided to develop a patch against 0.11.

Have fun

Add/Change #448 (Rewrite/refactor parts of routing, at least gen())

Author



Action
as new
 
Note: See TracTickets for help on using tickets.