| Accessing i18n columns while using sfPropelPager [message #48763] |
Sat, 29 March 2008 07:31  |
orkestra Messages: 65 Registered: May 2007 Location: Kuwait |
Member |
|
|
Hello all,
I'm using sfPropelPager to display a list of products on separate pages. The products table is internationalized (i.e. I have tables product and product_i18n).
The names of the products are in the product_i18n table. However, sfPropelPager doesn't seem to display the product names!
I'm using the following code to prepare and initialize the pager:
$c = new Criteria();
$c->add(ProductPeer::CATEGORY_ID, $cat);
$pager = new sfPropelPager('Product', 1);
$pager->setCriteria($c);
$pager->setPage($this->getRequestParameter('page', 1));
$pager->init();
$this->pager = $pager;
I tried adding $pager->setPeerMethod('doSelectWithI18n'), but the doSelectWithI18n method requires a culture, and I don't know how to pass the culture through the setPeerMethod.
Any help would be highly appreciated.
|
|
|
| Re: Accessing i18n columns while using sfPropelPager [message #49481 is a reply to message #48763 ] |
Tue, 08 April 2008 19:39  |
mitke.kg Messages: 4 Registered: March 2008 Location: Serbia / Kragujevac |
Junior Member |
|
|
I have the same problem. Solution (not the best one) that I've found is to set culture in the template or, more specific, in the foreach loop.
Example:
<?php
foreach ($pager->getResults() as $item) {
$item->setCulture('en');
echo $item->getTitle();
}
?>
If anyone discover some better solution plz write.
|
|
|