From 62dee1490b0911ae1d2c53de217605017f135363 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Sat, 3 Aug 2013 13:49:59 -0400 Subject: [PATCH] Fixes #709. --- framework/yii/data/Sort.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/framework/yii/data/Sort.php b/framework/yii/data/Sort.php index cb5dd82..4d7851a 100644 --- a/framework/yii/data/Sort.php +++ b/framework/yii/data/Sort.php @@ -191,17 +191,18 @@ class Sort extends Object { $attributes = array(); foreach ($this->attributes as $name => $attribute) { - if (is_array($attribute)) { - $attributes[$name] = $attribute; - if (!isset($attribute['label'])) { - $attributes[$name]['label'] = Inflector::camel2words($name); - } - } else { + if (!is_array($attribute)) { $attributes[$attribute] = array( 'asc' => array($attribute => self::ASC), 'desc' => array($attribute => self::DESC), 'label' => Inflector::camel2words($attribute), ); + } elseif (!isset($attribute['asc'], $attribute['desc'], $attribute['label'])) { + $attributes[$name] = array_merge(array( + 'asc' => array($name => self::ASC), + 'desc' => array($name => self::DESC), + 'label' => Inflector::camel2words($name), + ), $attribute); } } $this->attributes = $attributes;