Commit 54e08f3f by Qiang Xue

fixed build break.

parent 8b4dfcc8
...@@ -79,6 +79,17 @@ class ActiveQuery extends Query implements ActiveQueryInterface ...@@ -79,6 +79,17 @@ class ActiveQuery extends Query implements ActiveQueryInterface
/** /**
* Constructor.
* @param array $modelClass the model class associated with this query
* @param array $config configurations to be applied to the newly created query object
*/
public function __construct($modelClass, $config = [])
{
$this->modelClass = $modelClass;
parent::__construct($config);
}
/**
* Creates a DB command that can be used to execute this query. * Creates a DB command that can be used to execute this query.
* @param Connection $db the DB connection used to create the DB command. * @param Connection $db the DB connection used to create the DB command.
* If null, the DB connection returned by [[modelClass]] will be used. * If null, the DB connection returned by [[modelClass]] will be used.
......
...@@ -64,6 +64,18 @@ class ActiveQuery extends Query implements ActiveQueryInterface ...@@ -64,6 +64,18 @@ class ActiveQuery extends Query implements ActiveQueryInterface
use ActiveQueryTrait; use ActiveQueryTrait;
use ActiveRelationTrait; use ActiveRelationTrait;
/**
* Constructor.
* @param array $modelClass the model class associated with this query
* @param array $config configurations to be applied to the newly created query object
*/
public function __construct($modelClass, $config = [])
{
$this->modelClass = $modelClass;
parent::__construct($config);
}
/** /**
* @inheritdoc * @inheritdoc
*/ */
......
...@@ -40,6 +40,18 @@ class ActiveQuery extends Query implements ActiveQueryInterface ...@@ -40,6 +40,18 @@ class ActiveQuery extends Query implements ActiveQueryInterface
use ActiveQueryTrait; use ActiveQueryTrait;
use ActiveRelationTrait; use ActiveRelationTrait;
/**
* Constructor.
* @param array $modelClass the model class associated with this query
* @param array $config configurations to be applied to the newly created query object
*/
public function __construct($modelClass, $config = [])
{
$this->modelClass = $modelClass;
parent::__construct($config);
}
/** /**
* Executes query and returns all results as an array. * Executes query and returns all results as an array.
* @param \yii\mongodb\Connection $db the Mongo connection used to execute the query. * @param \yii\mongodb\Connection $db the Mongo connection used to execute the query.
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
namespace yii\redis; namespace yii\redis;
use yii\base\Component;
use yii\base\InvalidParamException; use yii\base\InvalidParamException;
use yii\base\NotSupportedException; use yii\base\NotSupportedException;
use yii\db\ActiveQueryInterface; use yii\db\ActiveQueryInterface;
...@@ -70,12 +71,24 @@ use yii\db\QueryTrait; ...@@ -70,12 +71,24 @@ use yii\db\QueryTrait;
* @author Carsten Brandt <mail@cebe.cc> * @author Carsten Brandt <mail@cebe.cc>
* @since 2.0 * @since 2.0
*/ */
class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface class ActiveQuery extends Component implements ActiveQueryInterface
{ {
use QueryTrait; use QueryTrait;
use ActiveQueryTrait; use ActiveQueryTrait;
use ActiveRelationTrait; use ActiveRelationTrait;
/**
* Constructor.
* @param array $modelClass the model class associated with this query
* @param array $config configurations to be applied to the newly created query object
*/
public function __construct($modelClass, $config = [])
{
$this->modelClass = $modelClass;
parent::__construct($config);
}
/** /**
* Executes the query and returns all results as an array. * Executes the query and returns all results as an array.
* @param Connection $db the database connection used to execute the query. * @param Connection $db the database connection used to execute the query.
......
...@@ -91,6 +91,18 @@ class ActiveQuery extends Query implements ActiveQueryInterface ...@@ -91,6 +91,18 @@ class ActiveQuery extends Query implements ActiveQueryInterface
*/ */
public $sql; public $sql;
/**
* Constructor.
* @param array $modelClass the model class associated with this query
* @param array $config configurations to be applied to the newly created query object
*/
public function __construct($modelClass, $config = [])
{
$this->modelClass = $modelClass;
parent::__construct($config);
}
/** /**
* Sets the [[snippetCallback]] to [[fetchSnippetSourceFromModels()]], which allows to * Sets the [[snippetCallback]] to [[fetchSnippetSourceFromModels()]], which allows to
* fetch the snippet source strings from the Active Record models, using method * fetch the snippet source strings from the Active Record models, using method
......
...@@ -66,7 +66,8 @@ class AttributeBehavior extends Behavior ...@@ -66,7 +66,8 @@ class AttributeBehavior extends Behavior
* The signature of the function should be as follows, * The signature of the function should be as follows,
* *
* ```php * ```php
* function ($event) { * function ($event)
* {
* // return value will be assigned to the attribute * // return value will be assigned to the attribute
* } * }
* ``` * ```
...@@ -83,7 +84,7 @@ class AttributeBehavior extends Behavior ...@@ -83,7 +84,7 @@ class AttributeBehavior extends Behavior
/** /**
* Evaluates the attribute value and assigns it to the current attributes. * Evaluates the attribute value and assigns it to the current attributes.
* @param $event * @param Event $event
*/ */
public function evaluateAttributes($event) public function evaluateAttributes($event)
{ {
......
...@@ -93,6 +93,17 @@ class ActiveQuery extends Query implements ActiveQueryInterface ...@@ -93,6 +93,17 @@ class ActiveQuery extends Query implements ActiveQueryInterface
/** /**
* Constructor.
* @param array $modelClass the model class associated with this query
* @param array $config configurations to be applied to the newly created query object
*/
public function __construct($modelClass, $config = [])
{
$this->modelClass = $modelClass;
parent::__construct($config);
}
/**
* Executes query and returns all results as an array. * Executes query and returns all results as an array.
* @param Connection $db the DB connection used to create the DB command. * @param Connection $db the DB connection used to create the DB command.
* If null, the DB connection returned by [[modelClass]] will be used. * If null, the DB connection returned by [[modelClass]] will be used.
...@@ -682,8 +693,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface ...@@ -682,8 +693,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
*/ */
public function viaTable($tableName, $link, $callable = null) public function viaTable($tableName, $link, $callable = null)
{ {
$relation = new ActiveQuery([ $relation = new ActiveQuery(get_class($this->primaryModel), [
'modelClass' => get_class($this->primaryModel),
'from' => [$tableName], 'from' => [$tableName],
'link' => $link, 'link' => $link,
'multiple' => true, 'multiple' => true,
......
...@@ -31,16 +31,6 @@ trait ActiveQueryTrait ...@@ -31,16 +31,6 @@ trait ActiveQueryTrait
public $asArray; public $asArray;
/**
* Constructor.
* @param array $modelClass the model class associated with this query
* @param array $config configurations to be applied to the newly created query object
*/
public function __construct($modelClass, $config = [])
{
$this->modelClass = $modelClass;
parent::__construct($config);
}
/** /**
* Sets the [[asArray]] property. * Sets the [[asArray]] property.
......
...@@ -14,13 +14,10 @@ class ArticleDb extends ActiveRecordDb ...@@ -14,13 +14,10 @@ class ArticleDb extends ActiveRecordDb
public function getIndex() public function getIndex()
{ {
$config = [ return new ActiveQuery(ArticleIndex::className(), [
'modelClass' => ArticleIndex::className(),
'primaryModel' => $this, 'primaryModel' => $this,
'link' => ['id' => 'id'], 'link' => ['id' => 'id'],
'multiple' => false, 'multiple' => false,
]; ]);
return new ActiveQuery($config);
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment