#5794: Router::url() prohibits 'id' from being a named arg
----------------------------------------------+-----------------------------
    Reporter:  kiger                          |          Type:  Bug      
      Status:  new                            |      Priority:  Medium   
   Milestone:  1.2.x.x                        |     Component:  Core Libs
     Version:  RC3                            |      Severity:  Normal   
    Keywords:  router url named id html link  |   Php_version:  n/a      
Cake_version:  7883                           |  
----------------------------------------------+-----------------------------
 Router::url() around line 844 shows something like this in svn rev
 7883:[[BR]]

 {{{
 // Remove this once parsed URL parameters can be inserted into 'pass'
 for ($i = 0; $i < $count; $i++) {
         if ($i === 0 && is_numeric($keys[$i]) && in_array('id', $keys)) {
                 $args[0] = $url[$keys[$i]];
         } elseif (is_numeric($keys[$i]) || $keys[$i] === 'id') {
                 $args[] = $url[$keys[$i]];
         } else {
                 $named[$keys[$i]] = $url[$keys[$i]];
         }
 }
 }}}
 I tried creating a html link using the following code:[[BR]]

 {{{
 $html->link($product['name'], array('controller'=>'search',
 'action'=>'products', 'id'=>$product['id']));
 }}}

 But Router::url(), which is called as a result of Html::link(), removes
 the 'id' from the named params and leaves: '''[[BR]]
 /search/products/744'''[[BR]][[BR]]

 I went back through the revisions and this code has always been there
 (minus some small tweaks to the conditional statements).[[BR]]
 [[BR]]
 Also, if this is the intended operation (I can't see how it could be
 though) it doesn't make sense that Html::link() prohibits 'id' as a named
 param yet Form::create() allows it if you try and create a form the same
 way.

-- 
Ticket URL: <https://trac.cakephp.org/ticket/5794>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design 
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. 
Our primary goal is to provide a structured framework that enables PHP users at 
all levels to rapidly develop robust web applications, without any loss to 
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tickets cakephp" 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/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---

  • [CakePHP : The Rapid Dev... CakePHP : The Rapid Development Framework for PHP

Reply via email to