I have such request
I know that OoCategory is exists, but i need to know if exists even if one record in oosItems, is it some way to make it fast in Yii, or i need check every OoCategory row?
Do you want to load OosCategory when exists at least one oosItems ?
No, OosCategory always load, i need to know if exists any items for any category,
there is no sense to show categories if there is no items.
If I understood well you want only OosCategories that has items. So,
$categories = OosCategory::model()->with('oosItems')->findAll('condition'=>'menu_id=:menu_id AND oosItems.fk_id=t.id','params'=>array(':menu_id'=>$menu_id));
whre t.id is the primary key of OosCategories and oosItems.fk_id the foreign key on the OosCategories