addInCondition('topic_id', $topicIds); $criteria->order = 'topic_id ASC, kp_id ASC'; $result = array(); $query = getAttributes($this->findAll($criteria)); if ($query) { foreach ($query AS $k => $v) { $result[$v['topic_id']][] = $v; } } return $result; } }