أنشئ حسابًا أو سجّل الدخول للانضمام إلى مجتمعك المهني.
$criteria = new CDbCriteria(); $criteria->select = 'type , seen, count(1) As counts'; $criteria->condition = 'mb = :mb AND deleted = false AND archived = false'; $criteria->params = array(':mb'=>$mb); $criteria->group = 'type ,seen'; $counters = $this->findAll($criteria); the problem is How can I get the value for (counts ) if its not as attribute on class? I try to $counters[0]->counts but not worked
You cant access the value unless its an attribute on the model (or) and attribute on the table,
quick solution :
on the model file add new attribute (member variable) and use it in the query
class xxModel {
public $countOfX;
}
$criteria = new CDbCriteria(); $criteria->select = 'type , seen, count(1) As countOfX'; $criteria->condition = 'mb = :mb AND deleted = false AND archived = false'; $criteria->params = array(':mb'=>$mb); $criteria->group = 'type ,seen'; $counters = $this->findAll($criteria);
هل تحتاج لمساعدة في كتابة سيرة ذاتية تحتوي على الكلمات الدلالية التي يبحث عنها أصحاب العمل؟