Skip to content

Commit

Permalink
made createQuery() config param optional
Browse files Browse the repository at this point in the history
  • Loading branch information
cebe committed Feb 20, 2014
1 parent 1708a36 commit 3b40d44
Show file tree
Hide file tree
Showing 15 changed files with 31 additions and 29 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ before_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 --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

#after_script:
Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@
"require-dev": {
"phpunit/phpunit": "3.7.*",
"twig/twig": "*",
"smarty/smarty": "*"
"smarty/smarty": "*",
"imagine/imagine": "v0.5.0",
"swiftmailer/swiftmailer": "*"
},
"suggest": {
"phpdocumentor/reflection": "required by yii2-apidoc extension",
Expand Down
6 changes: 3 additions & 3 deletions extensions/elasticsearch/ActiveRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ public static function mget($primaryKeys, $options = [])
* You may also define default conditions that should apply to all queries unless overridden:
*
* ```php
* public static function createQuery()
* public static function createQuery($config = [])
* {
* return parent::createQuery()->where(['deleted' => false]);
* return parent::createQuery($config)->where(['deleted' => false]);
* }
* ```
*
Expand All @@ -160,7 +160,7 @@ public static function mget($primaryKeys, $options = [])
* @param array $config the configuration passed to the ActiveRelation class.
* @return ActiveQuery the newly created [[ActiveQuery]] instance.
*/
public static function createQuery($config)
public static function createQuery($config = [])
{
$config['modelClass'] = get_called_class();
return new ActiveQuery($config);
Expand Down
6 changes: 3 additions & 3 deletions extensions/mongodb/ActiveRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ public static function deleteAll($condition = [], $options = [])
* You may also define default conditions that should apply to all queries unless overridden:
*
* ```php
* public static function createQuery()
* public static function createQuery($config = [])
* {
* return parent::createQuery()->where(['deleted' => false]);
* return parent::createQuery($config)->where(['deleted' => false]);
* }
* ```
*
Expand All @@ -114,7 +114,7 @@ public static function deleteAll($condition = [], $options = [])
* @param array $config the configuration passed to the ActiveRelation class.
* @return ActiveQuery the newly created [[ActiveQuery]] instance.
*/
public static function createQuery($config)
public static function createQuery($config = [])
{
$config['modelClass'] = get_called_class();
return new ActiveQuery($config);
Expand Down
6 changes: 3 additions & 3 deletions extensions/mongodb/file/ActiveRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -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:
*
* ```php
* public static function createQuery()
* public static function createQuery($config = [])
* {
* return parent::createQuery()->where(['deleted' => false]);
* return parent::createQuery($config)->where(['deleted' => false]);
* }
* ```
*
Expand All @@ -67,7 +67,7 @@ abstract class ActiveRecord extends \yii\mongodb\ActiveRecord
* @param array $config the configuration passed to the ActiveRelation class.
* @return ActiveQuery the newly created [[ActiveQuery]] instance.
*/
public static function createQuery($config)
public static function createQuery($config = [])
{
$config['modelClass'] = get_called_class();
return new ActiveQuery($config);
Expand Down
6 changes: 3 additions & 3 deletions extensions/redis/ActiveRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ public static function getDb()
* You may also define default conditions that should apply to all queries unless overridden:
*
* ```php
* public static function createQuery()
* public static function createQuery($config= [])
* {
* return parent::createQuery()->where(['deleted' => false]);
* return parent::createQuery($config)->where(['deleted' => false]);
* }
* ```
*
Expand All @@ -71,7 +71,7 @@ public static function getDb()
* @param array $config the configuration passed to the ActiveRelation class.
* @return ActiveQuery the newly created [[ActiveQuery]] instance.
*/
public static function createQuery($config)
public static function createQuery($config = [])
{
$config['modelClass'] = get_called_class();
return new ActiveQuery($config);
Expand Down
6 changes: 3 additions & 3 deletions extensions/sphinx/ActiveRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,9 +144,9 @@ public static function deleteAll($condition = '', $params = [])
* You may also define default conditions that should apply to all queries unless overridden:
*
* ```php
* public static function createQuery()
* public static function createQuery($config = [])
* {
* return parent::createQuery()->where(['deleted' => false]);
* return parent::createQuery($config)->where(['deleted' => false]);
* }
* ```
*
Expand All @@ -156,7 +156,7 @@ public static function deleteAll($condition = '', $params = [])
* @param array $config the configuration passed to the ActiveRelation class.
* @return ActiveQuery the newly created [[ActiveQuery]] instance.
*/
public static function createQuery($config)
public static function createQuery($config = [])
{
$config['modelClass'] = get_called_class();
return new ActiveQuery($config);
Expand Down
6 changes: 3 additions & 3 deletions framework/db/ActiveRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,9 +159,9 @@ public static function deleteAll($condition = '', $params = [])
* You may also define default conditions that should apply to all queries unless overridden:
*
* ```php
* public static function createQuery()
* public static function createQuery($config = [])
* {
* return parent::createQuery()->where(['deleted' => false]);
* return parent::createQuery($config)->where(['deleted' => false]);
* }
* ```
*
Expand All @@ -171,7 +171,7 @@ public static function deleteAll($condition = '', $params = [])
* @param array $config the configuration passed to the ActiveRelation class.
* @return ActiveQuery the newly created [[ActiveQuery]] instance.
*/
public static function createQuery($config)
public static function createQuery($config = [])
{
$config['modelClass'] = get_called_class();
return new ActiveQuery($config);
Expand Down
6 changes: 3 additions & 3 deletions framework/db/ActiveRecordInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@ public static function find($q = null);
* You may also define default conditions that should apply to all queries unless overridden:
*
* ```php
* public static function createQuery()
* public static function createQuery($config = [])
* {
* return parent::createQuery()->where(['deleted' => false]);
* return parent::createQuery($config)->where(['deleted' => false]);
* }
* ```
*
Expand All @@ -134,7 +134,7 @@ public static function find($q = null);
* @param array $config the configuration passed to the ActiveRelation class.
* @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.
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/data/ar/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function afterSave($insert)
parent::afterSave($insert);
}

public static function createQuery($config)
public static function createQuery($config = [])
{
$config['modelClass'] = get_called_class();
return new CustomerQuery($config);
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/data/ar/elasticsearch/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public static function setUpMapping($command, $statusIsBoolean = false)

}

public static function createQuery($config)
public static function createQuery($config = [])
{
$config['modelClass'] = get_called_class();
return new CustomerQuery($config);
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/data/ar/mongodb/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function getOrders()
return $this->hasMany(CustomerOrder::className(), ['customer_id' => '_id']);
}

public static function createQuery($config)
public static function createQuery($config = [])
{
$config['modelClass'] = get_called_class();
return new CustomerQuery($config);
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/data/ar/mongodb/file/CustomerFile.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public function attributes()
);
}

public static function createQuery($config)
public static function createQuery($config = [])
{
$config['modelClass'] = get_called_class();
return new CustomerFileQuery($config);
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/data/ar/redis/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public function afterSave($insert)
parent::afterSave($insert);
}

public static function createQuery($config)
public static function createQuery($config = [])
{
$config['modelClass'] = get_called_class();
return new CustomerQuery($config);
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/data/ar/sphinx/ArticleIndex.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public function getSnippetSource()
return $this->source->content;
}

public static function createQuery($config)
public static function createQuery($config = [])
{
$config['modelClass'] = get_called_class();
return new ArticleIndexQuery($config);
Expand Down

0 comments on commit 3b40d44

Please sign in to comment.