110 Commits

Author SHA1 Message Date
a036fac490 Extract cache from yii\db\Command to yii\db\CacheableQueryTrait and use it in yii\db\Query 2018-02-10 12:30:58 +02:00
b139e865b7 Fixed PHPDocs. Resolves discussion d16586334d (commitcomment-27343531) 2018-02-05 16:40:50 +02:00
d16586334d Fixes #7640: Implemented custom data types support. Added JSON support for MySQL and PostgreSQL, array support for PostgreSQL 2018-02-05 04:59:14 +07:00
5afe0a0d36 Fixes #15047: yii\db\Query::select() and yii\db\Query::addSelect() now check for duplicate column names 2018-02-04 23:41:33 +03:00
b979b2aa88 Fixes #15355: Additional test and fix 2018-02-03 20:10:13 +03:00
65f6b59b35 @inheritdoc notation changed 2018-01-23 13:11:24 +02:00
f8990ac97a Fixes #15353: Remove side effect of ActiveQuery::getTablesUsedInFrom() introduced in 2.0.13 2018-01-15 13:02:28 +03:00
8f2cd050af Fixed Query not to dig inside Expression 2017-12-21 16:16:33 +02:00
7e8a4c8629 Minor adjustments 2017-12-21 02:50:50 +03:00
ba931fa21d Fixes #15356: Fixed multiple bugs in yii\db\Query::getTablesUsedInFrom() 2017-12-21 01:35:08 +03:00
6c731d46d0 #15356: Initial version of yii\db\Query::getTablesUsedInFrom() fix and tests 2017-12-21 01:33:58 +03:00
dc019856b7 Fixes #15355: Fixed yii\db\Query::from() does not work with yii\db\Expression 2017-12-19 21:42:54 +03:00
2d672b6722 release version 2.0.13 2017-11-03 01:09:29 +03:00
5a8c3d537b Enable phpdoc_summary rule in php-cs-fixer config (#14675)
* Enable `phpdoc_summary` rule in php-cs-fixer config.

* Fix case in "PHPDoc".
2017-08-21 11:19:35 +02:00
1501c659ac Add empty lines before return statements. (#14682) [skip ci] 2017-08-21 01:58:49 +03:00
c9347b0a57 Fixed ambiguous column error on indexBy with JOIN
fixes #13859
close #14431
2017-07-12 12:26:30 +02:00
173108b5b0 Move getTablesUsedInFrom() from ActiveQuery to Query
enable this feature on the Query level

close #14431
2017-07-12 12:26:20 +02:00
fe8a0a6a2e Enable no_useless_else rule in php-cs-fixer (#14420) 2017-07-10 11:26:21 +03:00
53f380ca46 improved docs of Query::from()
fixes #14407
2017-07-07 13:30:19 +02:00
ba0ab403b5 Added php-cs-fixer coding standards validation to Travis CI (#14100)
* php-cs-fixer: PSR2 rule.

* php-cs-fixer: PSR2 rule - fix views.

* Travis setup refactoring.

* Add php-cs-fixer to travis cs tests.

* Fix tests on hhvm-3.12

* improve travis config

* composer update

* revert composer update

* improve travis config

* Fix CS.

* Extract config to separate classes.

* Extract config to separate classes.

* Add file header.

* Force short array syntax.

* binary_operator_spaces fixer

* Fix broken tests

* cast_spaces fixer

* concat_space fixer

* dir_constant fixer

* ereg_to_preg fixer

* function_typehint_space fixer

* hash_to_slash_comment fixer

* is_null fixer

* linebreak_after_opening_tag fixer

* lowercase_cast fixer

* magic_constant_casing fixer

* modernize_types_casting fixer

* native_function_casing fixer

* new_with_braces fixer

* no_alias_functions fixer

* no_blank_lines_after_class_opening fixer

* no_blank_lines_after_phpdoc fixer

* no_empty_comment fixer

* no_empty_phpdoc fixer

* no_empty_statement fixer

* no_extra_consecutive_blank_lines fixer

* no_leading_import_slash fixer

* no_leading_namespace_whitespace fixer

* no_mixed_echo_print fixer

* no_multiline_whitespace_around_double_arrow fixer

* no_multiline_whitespace_before_semicolons fixer

* no_php4_constructor fixer

* no_short_bool_cast fixer

* no_singleline_whitespace_before_semicolons fixer

* no_spaces_around_offset fixer

* no_trailing_comma_in_list_call fixer

* no_trailing_comma_in_singleline_array fixer

* no_unneeded_control_parentheses fixer

* no_unused_imports fixer

* no_useless_return fixer

* no_whitespace_before_comma_in_array fixer

* no_whitespace_in_blank_line fixer

* not_operator_with_successor_space fixer

* object_operator_without_whitespace fixer

* ordered_imports fixer

* php_unit_construct fixer

* php_unit_dedicate_assert fixer

* php_unit_fqcn_annotation fixer

* phpdoc_indent fixer

* phpdoc_no_access fixer

* phpdoc_no_empty_return fixer

* phpdoc_no_package fixer

* phpdoc_no_useless_inheritdoc fixer

* Fix broken tests

* phpdoc_return_self_reference fixer

* phpdoc_single_line_var_spacing fixer

* phpdoc_single_line_var_spacing fixer

* phpdoc_to_comment fixer

* phpdoc_trim fixer

* phpdoc_var_without_name fixer

* psr4 fixer

* self_accessor fixer

* short_scalar_cast fixer

* single_blank_line_before_namespace fixer

* single_quote fixer

* standardize_not_equals fixer

* ternary_operator_spaces fixer

* trailing_comma_in_multiline_array fixer

* trim_array_spaces fixer

* protected_to_private fixer

* unary_operator_spaces fixer

* whitespace_after_comma_in_array fixer

* `parent::setRules()` -> `$this->setRules()`

* blank_line_after_opening_tag fixer

* Update finder config.

* Revert changes for YiiRequirementChecker.

* Fix array formatting.

* Add missing import.

* Fix CS for new code merged from master.

* Fix some indentation issues.
2017-06-12 12:25:45 +03:00
7c6620a65f Fixes #13846: Fixed Query::count() issue with orderBy 2017-05-28 15:27:45 +03:00
13de76714b Refactored yii\db\Query::queryScalar() method 2017-02-23 22:01:48 +02:00
25e6eb04a5 refs #11122: Fixed can not use orderBy with aggregate functions (#12772)
* refs #11122: Fixed can not use `orderBy` with aggregate functions like `count`, `max` etc.

* Update QueryTest.php
2016-12-18 11:28:34 +02:00
350e93e626 Fixes #12612: Query conditions added with yii\db\Query::andWhere() now get appended to the existing conditions if they were already being joined with the and operator 2016-12-16 13:19:14 +03:00
518be6b8ec Enhanced PHPDocs markup 2016-12-14 23:07:44 +02:00
837b33767c Fixes #11697: Added filterHaving(), andFilterHaving() and orFilterHaving() to yii\db\Query
Signed-off-by: Alexander Makarov <sam@rmcreative.ru>
2016-12-14 23:58:04 +03:00
e78a7fe20e Initial work on #11697 2016-12-14 23:57:02 +03:00
c17766181f Added QueryInterface::emulateExecution()
Added `QueryInterface::emulateExecution()`, which allows preventing of
the actual query execution.
This allows to cancel `DataProvider` preventing search query execution
in case search model is invalid:

``` php
public function search($params)
    {
        $query = Item::find();

        $dataProvider = new ActiveDataProvider([
            'query' => $query,
        ]);

        $this->load($params);

        if (!$this->validate()) {
            $query->where('0=1');
            $query->emulateExecution(); // No SQL execution will be done
            return $dataProvider;
        }
```

This also fix unecessary query in case of `via()` usage. See #12390.

fixes #12390
fixes #6373
close #12708
2016-12-02 13:28:51 +01:00
4aa935e69e Fixes #12055: Changed boolean to bool and integer to int in phpdoc 2016-11-07 02:51:39 +03:00
677b55475b Reverted accidental commit 2016-10-12 00:38:54 +03:00
2ffa670885 add functions for filtering 2016-10-12 00:07:45 +03:00
e7195da4b3 Fix yii\db\Query::having phpdoc [skip ci] 2016-10-04 21:24:52 +02:00
95152f3c2c Fixed consistency of indexBy handling for yii\db\Query::column()
Closes #12649
2016-10-03 11:17:32 +03:00
d33227ab85 typo fix (#12217) [skip ci] 2016-08-21 12:58:11 +03:00
0061692e60 Replaced unnecessary double quotes with single quotes 2016-07-29 22:56:38 +03:00
e4dc2026bc note about JOIN syntax
fixes #7549
2016-06-20 13:04:08 +02:00
dbb54f986c Updated phpDoc of scalar 2016-05-25 09:14:31 +03:00
4411a74ebd proper fix for #9425, adjust changes from #11363
includes tests and fix that works in all cases.
2016-04-28 01:29:07 +02:00
f8a844a90f Query helper method for filter values containing operators
Basic implementation proposal for yiisoft/yii2#2022

Shortcomings/todo's:
* filtering on non-scalars (where IN statements) not supported
* Numeric properties with a corresponding validation rule will yield
  errors when they contain an alphanumeric operator. These properties'
  rules should be defined as 'string' or 'safe'.
* no implementation example in Gii code (yet).

close #8505
2016-04-22 14:05:24 +02:00
73eb62a3cd DBMS specific workarounds for unsupported SQL92 form of SELECT EXISTS() (#11369) 2016-04-17 17:44:52 +03:00
806eb57990 Fixes #9425: ActiveQuery::exists() should generate SELECT EXISTS() (#11363) 2016-04-16 13:34:20 +03:00
191f2a4943 fixed phpdoc type names 2016-02-25 20:24:32 +01:00
e43c41c9ea db layer phpdoc fixes 2016-02-07 16:33:26 +01:00
5a462dc5d2 added tests and documentation for #8824 2016-01-27 16:26:43 +01:00
468886a77b small refactoring for #9452 2015-12-06 06:04:46 +01:00
cd87d67f34 Global DOCS update: ~~~ replaced with ``` 2015-12-02 23:15:28 +02:00
7c7ed48c4c cleanup docs and duplicate code in query 2015-11-25 23:31:29 +01:00
decd45201c allow passing a single Expression object to select() and addSelect()
fixes #9883
2015-10-11 09:58:42 +02:00
4e7adc13ea adjusted docs about Query::from() and subqueries
also added a  test to verify behavior

close #9720
close #9266
2015-09-19 17:41:45 +02:00
a2f70f6484 Update Query doc return type
When used ActiveQuery chain call after call any of join type IDE cannot resolve ActiveQuery methods such an asArray
Example:
SomeActiveRecordModel::find()
            ->select('...') // return ActiveQuery
            ->leftJoin('...', '...') // return Query
            ->asArray() // it's become undefined
            ->column();
2015-08-21 17:14:00 +03:00