#1291: Routing fails to refill all parameters when same parameter name used in
consecutive route elements
------------------------------------+---------------------------------------
 Reporter:  nik_makepe...@…         |       Owner:  dominik                     
                                            
     Type:  defect                  |      Status:  new                         
                                            
 Priority:  normal                  |   Milestone:  1.0.4                       
                                            
Component:  routing                 |     Version:  1.0.3                       
                                            
 Severity:  normal                  |    Keywords:  routing 
refill_all_parameters surprising-behaviour documentation-missing
Has_patch:  0                       |  
------------------------------------+---------------------------------------

Comment(by david):

 I believe that is by design. The parameters are the same, but the
 respective routes didn't match. The {{{*}}} operator only refills matched
 params. Dominik?

 Why don't you structure it something like this:
 {{{
 #!xml
 <route name="conferences" pattern="^/conference" module="Conference">
         <route name=".conference"
 pattern="^/(conference_name:[a-zA-Z_\-0-9]+)" action="Conference">
                 <route name=".view" pattern="^$" action=".View" />
                 <route name=".registrations" pattern="^/registrations"
 action=".Registrations">
                         <route name=".registration"
 pattern="^/(registration_id:\d+)" action=".Registration">
                                 <route name=".view" pattern="^$"
 action=".View" />
                         </route>
                 </route>
         </route>
 </route>
 }}}
 If you do it that way, re-using routes and patterns is much simpler, your
 routing is easier to use, and you wouldn't even have to use the {{{*}}}
 operator when generating, say, a
 "conferences.conference.registrations.registration.delete" URL from
 "conferences.conference.registrations.registration.delete" (although I'd
 suggest always passing params explicitly, as otherwise you introduce odd
 bugs when copy/pasting code elsewhere). Such a hierarchy is much more
 logical, too, and easier to learn to a point where developers don't even
 have to look things up in the routing anymore. Plural, Singular, Plural,
 Singular, Operation. Also potentially easier to convert to a fully RESTful
 interface later :)

 P.S.: what's odd though is that the code handling the {{{*}}} operator is
 located in {{{AgaviWebRouting::gen()}}}, not in {{{AgaviRouting::gen()}}}.

-- 
Ticket URL: <http://trac.agavi.org/ticket/1291#comment:1>
Agavi <http://www.agavi.org/>
An MVC Framework for PHP5



_______________________________________________
Agavi Tickets Mailing List
[email protected]
http://lists.agavi.org/mailman/listinfo/tickets

Reply via email to