Is $product in your foreach loop a simple array or a doctrine record? When it is a doctrine record, this would work too (without doing further db queries):

<?php echo link_to($product['title'], 'product', $product) ?>


Frank


Am 08.02.2010 um 01:24 schrieb HiDDeN:

I have this route:

product:
 url:     /:slug-:id.html
 param:   { module: info, action: index }
 options: { model: Product, type: object, segment_separators: ['/',
'.', '-'] }

And I'm using this link_to inside a foreach (it's a list of products
urls):

<?php echo link_to($product['title'], "@product? slug={$product['slug']}
&id={$product['id']}") ?>

My list contains 50 products, and so there are 50 calls to the
database to retrieve each product. I don't know why... because I just
want to generate urls.

Anyone knows why?

--
You received this message because you are subscribed to the Google Groups "symfony users" group.
To post to this group, send email to symfony-us...@googlegroups.com.
To unsubscribe from this group, send email to symfony-users+unsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/symfony-users?hl=en .


--
You received this message because you are subscribed to the Google Groups "symfony 
users" group.
To post to this group, send email to symfony-us...@googlegroups.com.
To unsubscribe from this group, send email to 
symfony-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/symfony-users?hl=en.

Reply via email to