In the CGrid I’m using, there is a column that can be searched that relates to data in a different table. For example:
public function search()
{
$criteria=new CDbCriteria;
$criteria->compare('name',$this->name,true);
$criteria->compare('itemcategory.name',$this->category,true);
$criteria->compare('price',$this->price,true);
return new CActiveDataProvider(get_class($this), array(
'criteria'=>$criteria,
));
}
This function resides in the Item model, referencing the item table. You can see where I try to reference a different table (itemcategory), but when this runs it just checks the Item table for the itemcategory.name column. The itemcategory relation is properly setup.
Any ideas?