getAll(); $categories = new Category(); $categories = $categories->getAll(); foreach ($points as &$point) { $point->categoryIcon = $categories[$point->categoryId]['icon']; $point->categoryName = $categories[$point->categoryId]['name']; } self::renderPartial('json.php', array( 'data' => $points, )); } /** * Точка */ static function actionPoint() { $id = (int) App::getParam('id'); if ($id) { $point = new Point(); $point = $point->getByPK($id); $categories = new Category(); $categories = $categories->getAll(); $point->categoryIcon = $categories[$point->categoryId]['icon']; $point->categoryName = $categories[$point->categoryId]['name']; self::renderPartial('json.php', $point->getValues()); } else { App::error404(); } } /** * Категории */ static function actionCategories() { $categories = new Category(); $categories = $categories->getAll(); self::renderPartial('json.php', array( 'data' => $categories, )); } }