67 Commits

Author SHA1 Message Date
0af1c05d6a yii\db\ActiveRecord::findOne() now accepts column names prefixed with table name
fixes #15931
2018-03-21 17:44:22 +01:00
b37f361ad7 Fixed possible SQL injection through ActiveRecord::findOne() 2018-03-20 11:20:56 +01:00
52c80f782d moved SQL specific test to SQL AR 2018-03-12 11:21:05 +01:00
23b41220ce Fixed ActiveRecordTest::testCustomARRelation() to work on PHP <5.5 2018-02-21 22:22:06 +02:00
ef9600234e Fix magic getter for ActiveRecord (#15696) 2018-02-20 20:10:44 +05:00
7bd694dccb Enhanced tests 2018-02-16 00:06:59 +02:00
c3c9d1fd97 Merge branch 'master' into SamMousa-indexby-after-relations-9342
Conflicts:
	framework/db/Query.php
2018-02-15 23:38:06 +02:00
74dc1cdc30 Fixes #13618: Active record now resets related models after corresponding attributes updates
Co-authored-by: Robert Korulczyk <robert@korulczyk.pl>
2018-02-12 02:26:49 +03:00
40b038379f Fixes #13019: Support JSON in SchemaBuilderTrait 2018-02-06 16:35:49 +03:00
67f67e3a69 SCA with Php Inspections (EA Extended) (#15571) 2018-01-29 17:08:57 +07:00
71c541773f PHPDoc fix 2018-01-23 13:17:25 +02:00
65f6b59b35 @inheritdoc notation changed 2018-01-23 13:11:24 +02:00
b9cbc56330 Fixed yii\db\ActiveRecord::with() unable to use relation defined via attached behavior in case asArray is enabled 2018-01-23 12:46:56 +02:00
fb23b0d0ea Code style fixes 2017-11-01 02:43:02 +03:00
afd59a18ec Merge branch 'master' into indexby-after-relations-9342 2017-10-08 00:52:14 +02:00
d68789a195 Fixes #13779, fixes #5786
- #13779: Fixed `yii\db\ActiveRecord::joinWith()` unable to use relation defined via attached behavior.
- #5786: Allowed to use custom constructors in ActiveRecord-based classes.
2017-08-29 15:13:28 +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
0c0942d6e2 Enable phpdoc_add_missing_param_annotation rule in php-cs-fixer config. (#14681) [skip ci] 2017-08-21 01:57:23 +03:00
b99e955627 Fix CS (#14665)
* Run php-cs-fixer.

* Enable phpdoc_types rule.
2017-08-18 12:10:42 +02: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
0559a95db9 Fixed ambiguous column error in BaseActiveRecord::refresh()
when the query adds a JOIN by default

fixes #13757
2017-07-11 11:47:35 +02:00
d2781cd232 Added configuration for headers in PHP files generated by message/extract command (#14417) 2017-07-10 20:14:54 +03:00
f212bc6caf ensure tablenames are not replaced in insert and update 2017-06-16 16:02:34 +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
31e321b9b2 Remove unused imports. (#14096) 2017-05-01 20:26:15 +02:00
d8e6a89af9 fixed tests without assettions 2017-04-13 16:17:35 +03:00
dee88787fc compatibility with PHPUnit 6.x added 2017-04-13 14:49:43 +03:00
5675ed818d Fixed tests 2017-04-05 10:12:16 +02:00
7ab2a1efa8 Fixed test 2017-04-03 13:06:18 +02:00
e0e07c9c1b Added test for indexing by related fields. 2017-04-03 10:41:48 +02:00
13c2f5370f Fixed formatting in tests [skip ci] 2017-03-18 00:13:08 +03:00
3f8e8a89eb Used more specific unit test assertions in framework tests 2017-03-14 09:45:31 +03:00
6397791513 Fixed whitespaces to match code style [skip ci] 2017-03-14 09:42:13 +03:00
323568c2e9 Remove trailing spaces from sources and tests (#13621) [skip ci] 2017-02-19 17:34:22 +03:00
88f2348ed5 Fixed ActiveRecord::unlinkAll() to respect onCondition()
Closes #12213
2016-12-14 22:51:21 +02:00
50b668eee8 redundant code removed 2016-12-13 16:54:51 +02: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
3e1588b5b9 Added unit tests for #9561
canGetProperty and canSetProperty on ActiveRecord checks attributes

close #11087
2016-10-13 13:18:37 +02:00
8eaf4e2ffe #12544 - Added mote test cases for AssetBundleTest::testRegisterFileAppendTimestamp() 2016-09-15 19:51:17 +03:00
ea03f56d42 BaseActiveRecord methods canGetProperty() and canSetProperty() improved to handle attribute list fetching failure. 2016-09-05 12:22:09 +03:00
75439d367d Fixed canGetProperty() and canSetProperty() returns false for yii\db\BaseActiveRecord attributes 2016-08-30 17:39:23 +03:00
143f9070af Fixed yii\db\BaseActiveRecord::updateAttributes() change isNewRecord state for the new model 2016-08-12 11:43:31 +03:00
0f640c7138 Make sure inverseOf relations are also populated during dynamic relational queries
Refs #6347
2016-07-04 15:07:37 +02:00
a46e88dea5 fixed inverseof test assertation
fixed wrong test to actually test what it should.
current assertation is a duplicate.

thanks to @laszlovl for spotting it.

pr #8497
2016-07-04 13:41:02 +02:00
8ba032d147 refactored database tests
- changed test class naming for easier copying and searching of classes
- made base tests abstract and made MySQL an equal citisen in the test
  hierarchie
- added missing db specific test classes
2016-06-20 19:26:43 +02: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
37d2373911 added tests for #9047
1. verify it only affects composite primary key situation
2. add failing test for composite primary key situation with join
2016-04-22 16:39:06 +02:00
fd68e6814e added failing test for #11088 2016-04-22 11:01:53 +02:00
5921865459 Fixed: #11270 - Error when link record in one to many relation. (#11301)
Fixed: #11270 - Error when link record in one to many relation.
2016-04-08 10:36:38 +03:00