/** * Zwraca skladniki w tablicy asocjacyjnej pogrupowane wzgledem typu * */ protected function getSortedCourses() { $aResult = array(); $oType = new Model_Type(); $oCourse = new Model_Course(); // $aTypes = $oType->where( 'account_id', (int) $this->oCurrentUser->account_id )-> $aCourses = $oCourse->getCoursesForAccount((int) $this->oCurrentUser->account_id); foreach ($aCourses as $aCourse) { $aResult[$aCourse['type']][] = array('course_id' => $aCourse['course_id'], 'name' => $aCourse['name'], 'price' => $aCourse['price']); } return $aResult; }