From 5d9c23c67bdf200e00382d92fe32dde94883e01e Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Tue, 30 Jul 2013 12:01:02 -0400 Subject: [PATCH] Added Sort::hasAttribute(). --- framework/yii/data/Sort.php | 10 ++++++++++ framework/yii/db/ColumnSchema.php | 4 +++- framework/yii/db/Schema.php | 3 ++- framework/yii/db/TableSchema.php | 3 ++- 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/framework/yii/data/Sort.php b/framework/yii/data/Sort.php index a466637..cb5dd82 100644 --- a/framework/yii/data/Sort.php +++ b/framework/yii/data/Sort.php @@ -358,4 +358,14 @@ class Sort extends Object } return implode($this->separators[0], $sorts); } + + /** + * Returns a value indicating whether the sort definition supports sorting by the named attribute. + * @param string $name the attribute name + * @return boolean whether the sort definition supports sorting by the named attribute. + */ + public function hasAttribute($name) + { + return isset($this->attributes[$name]); + } } diff --git a/framework/yii/db/ColumnSchema.php b/framework/yii/db/ColumnSchema.php index 83453e4..cd2d9fa 100644 --- a/framework/yii/db/ColumnSchema.php +++ b/framework/yii/db/ColumnSchema.php @@ -7,13 +7,15 @@ namespace yii\db; +use yii\base\Object; + /** * ColumnSchema class describes the metadata of a column in a database table. * * @author Qiang Xue * @since 2.0 */ -class ColumnSchema extends \yii\base\Component +class ColumnSchema extends Object { /** * @var string name of this column (without quotes). diff --git a/framework/yii/db/Schema.php b/framework/yii/db/Schema.php index 6ae9ab7..1aef764 100644 --- a/framework/yii/db/Schema.php +++ b/framework/yii/db/Schema.php @@ -8,6 +8,7 @@ namespace yii\db; use Yii; +use yii\base\Object; use yii\base\NotSupportedException; use yii\base\InvalidCallException; use yii\caching\Cache; @@ -25,7 +26,7 @@ use yii\caching\GroupDependency; * @author Qiang Xue * @since 2.0 */ -abstract class Schema extends \yii\base\Object +abstract class Schema extends Object { /** * The followings are the supported abstract column data types. diff --git a/framework/yii/db/TableSchema.php b/framework/yii/db/TableSchema.php index 1065b51..cad4c0a 100644 --- a/framework/yii/db/TableSchema.php +++ b/framework/yii/db/TableSchema.php @@ -7,6 +7,7 @@ namespace yii\db; +use yii\base\Object; use yii\base\InvalidParamException; /** @@ -17,7 +18,7 @@ use yii\base\InvalidParamException; * @author Qiang Xue * @since 2.0 */ -class TableSchema extends \yii\base\Object +class TableSchema extends Object { /** * @var string name of the catalog (database) that this table belongs to.