Here is my code:
$criteria=new CDbCriteria(array(
'condition'=>'product_master = 0',
'order'=>'date_added DESC',
'with'=>array('systems','modules')
));
if(isset($_GET['mid']))
$criteria->addCondition('modules.oem_module_id = ' . (int)$_GET['mid']);
if(isset($_GET['sid']))
$criteria->addCondition('systems.oem_system_id = ' . (int)$_GET['sid']);
$pages = new CPagination(Product::model()->count($criteria));
$pages->pageSize=self::PAGE_SIZE;
$pages->applyLimit($criteria);
$products = Product::model()->findAll($criteria);
As can be seen, I have three tables: products, systems(alias declared in relations), modules (alias declared in relations).
The problem:
Product::model()->count($criteria) executes a perfect query with the expected joins.
Product::model()->findAll($criteria) fails. The joins are missing, thus systems.oem_system_id or modules.oem_module_id are declared as "Column not found".
What am I doing wrong??

Help














