Commit 3b40d449 by Carsten Brandt

made createQuery() config param optional

parent 1708a36d
...@@ -36,7 +36,7 @@ before_script: ...@@ -36,7 +36,7 @@ before_script:
script: script:
# - vendor/bin/phpunit --coverage-clover tests/unit/runtime/coveralls/clover.xml --verbose --exclude-group mssql,oci,wincache,xcache,zenddata,vendor # - vendor/bin/phpunit --coverage-clover tests/unit/runtime/coveralls/clover.xml --verbose --exclude-group mssql,oci,wincache,xcache,zenddata,vendor
- vendor/bin/phpunit --verbose --exclude-group mssql,oci,wincache,xcache,zenddata,vendor - vendor/bin/phpunit --verbose --exclude-group mssql,oci,wincache,xcache,zenddata
- cd apps/basic && php vendor/bin/codecept run - cd apps/basic && php vendor/bin/codecept run
#after_script: #after_script:
......
...@@ -80,7 +80,9 @@ ...@@ -80,7 +80,9 @@
"require-dev": { "require-dev": {
"phpunit/phpunit": "3.7.*", "phpunit/phpunit": "3.7.*",
"twig/twig": "*", "twig/twig": "*",
"smarty/smarty": "*" "smarty/smarty": "*",
"imagine/imagine": "v0.5.0",
"swiftmailer/swiftmailer": "*"
}, },
"suggest": { "suggest": {
"phpdocumentor/reflection": "required by yii2-apidoc extension", "phpdocumentor/reflection": "required by yii2-apidoc extension",
......
...@@ -148,9 +148,9 @@ class ActiveRecord extends BaseActiveRecord ...@@ -148,9 +148,9 @@ class ActiveRecord extends BaseActiveRecord
* You may also define default conditions that should apply to all queries unless overridden: * You may also define default conditions that should apply to all queries unless overridden:
* *
* ```php * ```php
* public static function createQuery() * public static function createQuery($config = [])
* { * {
* return parent::createQuery()->where(['deleted' => false]); * return parent::createQuery($config)->where(['deleted' => false]);
* } * }
* ``` * ```
* *
...@@ -160,7 +160,7 @@ class ActiveRecord extends BaseActiveRecord ...@@ -160,7 +160,7 @@ class ActiveRecord extends BaseActiveRecord
* @param array $config the configuration passed to the ActiveRelation class. * @param array $config the configuration passed to the ActiveRelation class.
* @return ActiveQuery the newly created [[ActiveQuery]] instance. * @return ActiveQuery the newly created [[ActiveQuery]] instance.
*/ */
public static function createQuery($config) public static function createQuery($config = [])
{ {
$config['modelClass'] = get_called_class(); $config['modelClass'] = get_called_class();
return new ActiveQuery($config); return new ActiveQuery($config);
......
...@@ -102,9 +102,9 @@ abstract class ActiveRecord extends BaseActiveRecord ...@@ -102,9 +102,9 @@ abstract class ActiveRecord extends BaseActiveRecord
* You may also define default conditions that should apply to all queries unless overridden: * You may also define default conditions that should apply to all queries unless overridden:
* *
* ```php * ```php
* public static function createQuery() * public static function createQuery($config = [])
* { * {
* return parent::createQuery()->where(['deleted' => false]); * return parent::createQuery($config)->where(['deleted' => false]);
* } * }
* ``` * ```
* *
...@@ -114,7 +114,7 @@ abstract class ActiveRecord extends BaseActiveRecord ...@@ -114,7 +114,7 @@ abstract class ActiveRecord extends BaseActiveRecord
* @param array $config the configuration passed to the ActiveRelation class. * @param array $config the configuration passed to the ActiveRelation class.
* @return ActiveQuery the newly created [[ActiveQuery]] instance. * @return ActiveQuery the newly created [[ActiveQuery]] instance.
*/ */
public static function createQuery($config) public static function createQuery($config = [])
{ {
$config['modelClass'] = get_called_class(); $config['modelClass'] = get_called_class();
return new ActiveQuery($config); return new ActiveQuery($config);
......
...@@ -55,9 +55,9 @@ abstract class ActiveRecord extends \yii\mongodb\ActiveRecord ...@@ -55,9 +55,9 @@ abstract class ActiveRecord extends \yii\mongodb\ActiveRecord
* You may also define default conditions that should apply to all queries unless overridden: * You may also define default conditions that should apply to all queries unless overridden:
* *
* ```php * ```php
* public static function createQuery() * public static function createQuery($config = [])
* { * {
* return parent::createQuery()->where(['deleted' => false]); * return parent::createQuery($config)->where(['deleted' => false]);
* } * }
* ``` * ```
* *
...@@ -67,7 +67,7 @@ abstract class ActiveRecord extends \yii\mongodb\ActiveRecord ...@@ -67,7 +67,7 @@ abstract class ActiveRecord extends \yii\mongodb\ActiveRecord
* @param array $config the configuration passed to the ActiveRelation class. * @param array $config the configuration passed to the ActiveRelation class.
* @return ActiveQuery the newly created [[ActiveQuery]] instance. * @return ActiveQuery the newly created [[ActiveQuery]] instance.
*/ */
public static function createQuery($config) public static function createQuery($config = [])
{ {
$config['modelClass'] = get_called_class(); $config['modelClass'] = get_called_class();
return new ActiveQuery($config); return new ActiveQuery($config);
......
...@@ -59,9 +59,9 @@ class ActiveRecord extends BaseActiveRecord ...@@ -59,9 +59,9 @@ class ActiveRecord extends BaseActiveRecord
* You may also define default conditions that should apply to all queries unless overridden: * You may also define default conditions that should apply to all queries unless overridden:
* *
* ```php * ```php
* public static function createQuery() * public static function createQuery($config= [])
* { * {
* return parent::createQuery()->where(['deleted' => false]); * return parent::createQuery($config)->where(['deleted' => false]);
* } * }
* ``` * ```
* *
...@@ -71,7 +71,7 @@ class ActiveRecord extends BaseActiveRecord ...@@ -71,7 +71,7 @@ class ActiveRecord extends BaseActiveRecord
* @param array $config the configuration passed to the ActiveRelation class. * @param array $config the configuration passed to the ActiveRelation class.
* @return ActiveQuery the newly created [[ActiveQuery]] instance. * @return ActiveQuery the newly created [[ActiveQuery]] instance.
*/ */
public static function createQuery($config) public static function createQuery($config = [])
{ {
$config['modelClass'] = get_called_class(); $config['modelClass'] = get_called_class();
return new ActiveQuery($config); return new ActiveQuery($config);
......
...@@ -144,9 +144,9 @@ abstract class ActiveRecord extends BaseActiveRecord ...@@ -144,9 +144,9 @@ abstract class ActiveRecord extends BaseActiveRecord
* You may also define default conditions that should apply to all queries unless overridden: * You may also define default conditions that should apply to all queries unless overridden:
* *
* ```php * ```php
* public static function createQuery() * public static function createQuery($config = [])
* { * {
* return parent::createQuery()->where(['deleted' => false]); * return parent::createQuery($config)->where(['deleted' => false]);
* } * }
* ``` * ```
* *
...@@ -156,7 +156,7 @@ abstract class ActiveRecord extends BaseActiveRecord ...@@ -156,7 +156,7 @@ abstract class ActiveRecord extends BaseActiveRecord
* @param array $config the configuration passed to the ActiveRelation class. * @param array $config the configuration passed to the ActiveRelation class.
* @return ActiveQuery the newly created [[ActiveQuery]] instance. * @return ActiveQuery the newly created [[ActiveQuery]] instance.
*/ */
public static function createQuery($config) public static function createQuery($config = [])
{ {
$config['modelClass'] = get_called_class(); $config['modelClass'] = get_called_class();
return new ActiveQuery($config); return new ActiveQuery($config);
......
...@@ -159,9 +159,9 @@ class ActiveRecord extends BaseActiveRecord ...@@ -159,9 +159,9 @@ class ActiveRecord extends BaseActiveRecord
* You may also define default conditions that should apply to all queries unless overridden: * You may also define default conditions that should apply to all queries unless overridden:
* *
* ```php * ```php
* public static function createQuery() * public static function createQuery($config = [])
* { * {
* return parent::createQuery()->where(['deleted' => false]); * return parent::createQuery($config)->where(['deleted' => false]);
* } * }
* ``` * ```
* *
...@@ -171,7 +171,7 @@ class ActiveRecord extends BaseActiveRecord ...@@ -171,7 +171,7 @@ class ActiveRecord extends BaseActiveRecord
* @param array $config the configuration passed to the ActiveRelation class. * @param array $config the configuration passed to the ActiveRelation class.
* @return ActiveQuery the newly created [[ActiveQuery]] instance. * @return ActiveQuery the newly created [[ActiveQuery]] instance.
*/ */
public static function createQuery($config) public static function createQuery($config = [])
{ {
$config['modelClass'] = get_called_class(); $config['modelClass'] = get_called_class();
return new ActiveQuery($config); return new ActiveQuery($config);
......
...@@ -122,9 +122,9 @@ interface ActiveRecordInterface ...@@ -122,9 +122,9 @@ interface ActiveRecordInterface
* You may also define default conditions that should apply to all queries unless overridden: * You may also define default conditions that should apply to all queries unless overridden:
* *
* ```php * ```php
* public static function createQuery() * public static function createQuery($config = [])
* { * {
* return parent::createQuery()->where(['deleted' => false]); * return parent::createQuery($config)->where(['deleted' => false]);
* } * }
* ``` * ```
* *
...@@ -134,7 +134,7 @@ interface ActiveRecordInterface ...@@ -134,7 +134,7 @@ interface ActiveRecordInterface
* @param array $config the configuration passed to the ActiveRelation class. * @param array $config the configuration passed to the ActiveRelation class.
* @return ActiveQueryInterface the newly created [[ActiveQueryInterface|ActiveQuery]] instance. * @return ActiveQueryInterface the newly created [[ActiveQueryInterface|ActiveQuery]] instance.
*/ */
public static function createQuery($config); public static function createQuery($config = []);
/** /**
* Updates records using the provided attribute values and conditions. * Updates records using the provided attribute values and conditions.
......
...@@ -41,7 +41,7 @@ class Customer extends ActiveRecord ...@@ -41,7 +41,7 @@ class Customer extends ActiveRecord
parent::afterSave($insert); parent::afterSave($insert);
} }
public static function createQuery($config) public static function createQuery($config = [])
{ {
$config['modelClass'] = get_called_class(); $config['modelClass'] = get_called_class();
return new CustomerQuery($config); return new CustomerQuery($config);
......
...@@ -63,7 +63,7 @@ class Customer extends ActiveRecord ...@@ -63,7 +63,7 @@ class Customer extends ActiveRecord
} }
public static function createQuery($config) public static function createQuery($config = [])
{ {
$config['modelClass'] = get_called_class(); $config['modelClass'] = get_called_class();
return new CustomerQuery($config); return new CustomerQuery($config);
......
...@@ -25,7 +25,7 @@ class Customer extends ActiveRecord ...@@ -25,7 +25,7 @@ class Customer extends ActiveRecord
return $this->hasMany(CustomerOrder::className(), ['customer_id' => '_id']); return $this->hasMany(CustomerOrder::className(), ['customer_id' => '_id']);
} }
public static function createQuery($config) public static function createQuery($config = [])
{ {
$config['modelClass'] = get_called_class(); $config['modelClass'] = get_called_class();
return new CustomerQuery($config); return new CustomerQuery($config);
......
...@@ -20,7 +20,7 @@ class CustomerFile extends ActiveRecord ...@@ -20,7 +20,7 @@ class CustomerFile extends ActiveRecord
); );
} }
public static function createQuery($config) public static function createQuery($config = [])
{ {
$config['modelClass'] = get_called_class(); $config['modelClass'] = get_called_class();
return new CustomerFileQuery($config); return new CustomerFileQuery($config);
......
...@@ -31,7 +31,7 @@ class Customer extends ActiveRecord ...@@ -31,7 +31,7 @@ class Customer extends ActiveRecord
parent::afterSave($insert); parent::afterSave($insert);
} }
public static function createQuery($config) public static function createQuery($config = [])
{ {
$config['modelClass'] = get_called_class(); $config['modelClass'] = get_called_class();
return new CustomerQuery($config); return new CustomerQuery($config);
......
...@@ -25,7 +25,7 @@ class ArticleIndex extends ActiveRecord ...@@ -25,7 +25,7 @@ class ArticleIndex extends ActiveRecord
return $this->source->content; return $this->source->content;
} }
public static function createQuery($config) public static function createQuery($config = [])
{ {
$config['modelClass'] = get_called_class(); $config['modelClass'] = get_called_class();
return new ArticleIndexQuery($config); return new ArticleIndexQuery($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