Skip to content
Browse files

docs for CSqlDataProvider allowing CDbCommand as SQL statement

pull request #1500
  • Loading branch information...
1 parent e8a93ac commit 9852b65636ec2f8b8deca8f85270dcee93f280ae @cebe cebe committed Oct 10, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 framework/web/CSqlDataProvider.php
View
5 framework/web/CSqlDataProvider.php
@@ -44,6 +44,7 @@ class CSqlDataProvider extends CDataProvider
public $db;
/**
* @var string|CDbCommand the SQL statement to be used for fetching data rows.
+ * Since version 1.1.13 this can also be an instance of {@link CDbCommand}.
*/
public $sql;
/**
@@ -57,7 +58,7 @@ class CSqlDataProvider extends CDataProvider
/**
* Constructor.
- * @param string|CDbCommand $sql the SQL statement to be used for fetching data rows.
+ * @param string|CDbCommand $sql the SQL statement to be used for fetching data rows. Since version 1.1.13 this can also be an instance of {@link CDbCommand}.
* @param array $config configuration (name=>value) to be applied as the initial property values of this class.
*/
public function __construct($sql,$config=array())
@@ -73,7 +74,7 @@ public function __construct($sql,$config=array())
*/
protected function fetchData()
{
- if(!$this->sql instanceof CDbCommand)
+ if(!($this->sql instanceof CDbCommand))
{
$db=$this->db===null ? Yii::app()->db : $this->db;
$command=$db->createCommand($this->sql);

0 comments on commit 9852b65

Please sign in to comment.
Something went wrong with that request. Please try again.