From efa1fba20e8de4b3747853ab1adb470a4606ec66 Mon Sep 17 00:00:00 2001 From: Krivchikov Dmitry Date: Thu, 3 Sep 2015 00:23:48 +0300 Subject: [PATCH] =?UTF-8?q?FIX=20=D1=87=D1=83=D1=82=D1=8C=20=D0=BF=D0=BE?= =?UTF-8?q?=D0=BF=D1=80=D0=B0=D0=B2=D0=BB=D0=B5=D0=BD=D0=B0=20=D0=BC=D0=BE?= =?UTF-8?q?=D0=B4=D0=B5=D0=BB=D1=8C,=20=D0=B2=20JSON-=D0=BA=D0=BE=D0=BD?= =?UTF-8?q?=D1=82=D1=80=D0=BE=D0=BB=D0=BB=D0=B5=D1=80=D0=B5=20=D0=B2=20?= =?UTF-8?q?=D0=BA=D0=B0=D1=82=D0=B5=D0=B3=D0=BE=D1=80=D0=B8=D1=8F=D1=85=20?= =?UTF-8?q?=D0=BE=D1=82=D0=B4=D0=B0=D1=91=D1=82=D1=81=D1=8F=20=D0=BC=D0=B0?= =?UTF-8?q?=D1=81=D1=81=D0=B8=D0=B2=20=D0=BE=D0=B1=D1=8A=D0=B5=D0=BA=D1=82?= =?UTF-8?q?=D0=BE=D0=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ground/classes/Model.php | 6 +++++- ground/controllers/JsonController.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ground/classes/Model.php b/ground/classes/Model.php index 2533b6d..c1f8645 100644 --- a/ground/classes/Model.php +++ b/ground/classes/Model.php @@ -157,7 +157,11 @@ abstract class Model if (isset($params['noKeys'])) { $ready[] = isset($params['asArray']) && $params['asArray'] ? $row : new $calledClass($row); } else { - $ready[$row[$this->_primaryKey_]] = isset($params['asArray']) && $params['asArray'] ? $row : new $calledClass($row); + if (isset($params['asArrayOf'])) { + $ready[] = isset($params['asArray']) && $params['asArray'] ? $row : new $calledClass($row); + } else { + $ready[$row[$this->_primaryKey_]] = isset($params['asArray']) && $params['asArray'] ? $row : new $calledClass($row); + } } } diff --git a/ground/controllers/JsonController.php b/ground/controllers/JsonController.php index 545e977..5615831 100644 --- a/ground/controllers/JsonController.php +++ b/ground/controllers/JsonController.php @@ -93,7 +93,7 @@ class JsonController extends Controller */ static function actionCategories() { - $categories = Category::model()->getAll(array('order' => 'ord ASC', 'asArray' => true)); + $categories = Category::model()->getAll(array('order' => 'ord ASC', 'asArray' => true, 'asArrayOf' => true)); self::renderPartial('json.php', array( 'data' => $categories,