Advertisement
Guest User

Untitled

a guest
Jul 13th, 2011
213
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. foo:
  2. pattern: /foo/{bar}/{car}
  3. defaults:
  4. bar: barValue
  5. car: carValue
  6.  
  7. Generate a route in a controller:
  8.  
  9. $this->get('router')->generate('foo', array('bar' => 'barValue', 'car' => 'somethingElse');
  10.  
  11. In your scenario where a default value is hidden from the url 'barValue' would NOT be added to the url because it matches the default value so the generated url would be: /foo/somethingElse
  12.  
  13. Now if someone clicked that link and requested /foo/somethingElse and it happened to match the foo route then it would be the equivalent of /foo/somethingElse/carValue
  14.  
  15. The bar and car param has been mixed up.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement