Commit 54e08f3f by Qiang Xue

fixed build break.

parent 8b4dfcc8
......@@ -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.
* @param Connection $db the DB connection used to create the DB command.
* If null, the DB connection returned by [[modelClass]] will be used.
......
......@@ -64,6 +64,18 @@ class ActiveQuery extends Query implements ActiveQueryInterface
use ActiveQueryTrait;
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
*/
......
......@@ -40,6 +40,18 @@ class ActiveQuery extends Query implements ActiveQueryInterface
use ActiveQueryTrait;
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.
* @param \yii\mongodb\Connection $db the Mongo connection used to execute the query.
......
......@@ -7,6 +7,7 @@
namespace yii\redis;
use yii\base\Component;
use yii\base\InvalidParamException;
use yii\base\NotSupportedException;
use yii\db\ActiveQueryInterface;
......@@ -70,12 +71,24 @@ use yii\db\QueryTrait;
* @author Carsten Brandt <mail@cebe.cc>
* @since 2.0
*/
class ActiveQuery extends \yii\base\Component implements ActiveQueryInterface
class ActiveQuery extends Component implements ActiveQueryInterface
{
use QueryTrait;
use ActiveQueryTrait;
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.
* @param Connection $db the database connection used to execute the query.
......
......@@ -91,6 +91,18 @@ class ActiveQuery extends Query implements ActiveQueryInterface
*/
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
* fetch the snippet source strings from the Active Record models, using method
......
......@@ -66,7 +66,8 @@ class AttributeBehavior extends Behavior
* The signature of the function should be as follows,
*
* ```php
* function ($event) {
* function ($event)
* {
* // return value will be assigned to the attribute
* }
* ```
......@@ -83,7 +84,7 @@ class AttributeBehavior extends Behavior
/**
* Evaluates the attribute value and assigns it to the current attributes.
* @param $event
* @param Event $event
*/
public function evaluateAttributes($event)
{
......
......@@ -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.
* @param Connection $db the DB connection used to create the DB command.
* If null, the DB connection returned by [[modelClass]] will be used.
......@@ -682,8 +693,7 @@ class ActiveQuery extends Query implements ActiveQueryInterface
*/
public function viaTable($tableName, $link, $callable = null)
{
$relation = new ActiveQuery([
'modelClass' => get_class($this->primaryModel),
$relation = new ActiveQuery(get_class($this->primaryModel), [
'from' => [$tableName],
'link' => $link,
'multiple' => true,
......
......@@ -31,16 +31,6 @@ trait ActiveQueryTrait
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.
......
......@@ -14,13 +14,10 @@ class ArticleDb extends ActiveRecordDb
public function getIndex()
{
$config = [
'modelClass' => ArticleIndex::className(),
return new ActiveQuery(ArticleIndex::className(), [
'primaryModel' => $this,
'link' => ['id' => 'id'],
'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