Commit Graph

32 Commits

Author SHA1 Message Date
SilverFire - Dmitry Naumenko
88f2348ed5 Fixed ActiveRecord::unlinkAll() to respect onCondition()
Closes #12213
2016-12-14 22:51:21 +02:00
Klimov Paul
50b668eee8 redundant code removed 2016-12-13 16:54:51 +02:00
Klimov Paul
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
p.chapl
3e1588b5b9 Added unit tests for #9561
canGetProperty and canSetProperty on ActiveRecord checks attributes

close #11087
2016-10-13 13:18:37 +02:00
SilverFire - Dmitry Naumenko
8eaf4e2ffe #12544 - Added mote test cases for AssetBundleTest::testRegisterFileAppendTimestamp() 2016-09-15 19:51:17 +03:00
Klimov Paul
ea03f56d42 BaseActiveRecord methods canGetProperty() and canSetProperty() improved to handle attribute list fetching failure. 2016-09-05 12:22:09 +03:00
Klimov Paul
75439d367d Fixed canGetProperty() and canSetProperty() returns false for yii\db\BaseActiveRecord attributes 2016-08-30 17:39:23 +03:00
Klimov Paul
143f9070af Fixed yii\db\BaseActiveRecord::updateAttributes() change isNewRecord state for the new model 2016-08-12 11:43:31 +03:00
Laszlovl
0f640c7138 Make sure inverseOf relations are also populated during dynamic relational queries
Refs #6347
2016-07-04 15:07:37 +02:00
Carsten Brandt
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
Carsten Brandt
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
Carsten Brandt
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
Carsten Brandt
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
Carsten Brandt
fd68e6814e added failing test for #11088 2016-04-22 11:01:53 +02:00
Ivaylo Ushev
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
Carsten Brandt
ce35739469 joinWith implementation cleanup 2016-02-12 12:45:29 +01:00
Carsten Brandt
3f8df39f45 more tests for joinWith alias
also test on joining the same relation twice
2016-02-12 12:35:29 +01:00
Carsten Brandt
94571e2c23 improved tests for ActiveQuery::joinWith alias 2016-02-12 12:35:29 +01:00
Carsten Brandt
5f19e7aa41 Added Alias Syntax for joinWith()
Add alias syntax to joinWith(), e.g. joinWith('author a').
No need to know the table name for defining an alias for the relation.

fixes #2377, alternative to #8788, which allows later implementation of
getting alias and column name ambiguation.

depends on #10813 to be merged first.
2016-02-12 12:35:28 +01:00
Carsten Brandt
157d6c79cc fixes #4972 by adding and alias() to ActiveQuery
allows defining an alias without knowing the model table name.
2016-02-12 12:34:16 +01:00
nainoon
076329bfba add test for join with alias
close #8788
2016-02-12 12:26:34 +01:00
Alexander Makarov
615a29f04e More fixes for MSSQL tests 2015-12-09 03:07:32 +03:00
Alexander Makarov
8765cae71c Reverted #9656 because of BC break (reverted from commit 4a464afe9b) 2015-11-25 06:41:55 +03:00
Sam Mousa
4a464afe9b Fixes #9656: yii\db\BaseActiveRecord refactored in order to getting, setting and unsetring attribute values using the same approach 2015-11-20 15:45:12 +03:00
Alexander Makarov
357bce51bb Tests for #9006 2015-07-30 19:25:52 +03:00
Carsten Brandt
d0c6cb7700 abort removing duplicate records when pk is not in result set
in this cases it does not make sense to remove duplicates as the result is not on record level anymore.
This could be the case after GROUP BY has been applied.

fixes #8772
2015-06-14 19:29:57 +02:00
Klimov Paul
a849e815df Fixed yii\db\ActiveQuery produces incorrect SQL for aggregations, when sql field is set 2015-05-29 13:18:20 +03:00
Klimov Paul
51a442d6c8 Fixed yii\db\ActiveRecord does not updates attribute specified at optimisticLock() after save 2015-05-26 11:53:34 +03:00
John Was
57db031d1c Merge branch 'master' into 7374-inserting-ar-without-values 2015-05-24 23:29:40 +02:00
Klimov Paul
6d96d3cbee Fixed yii\db\BaseActiveRecord::updateCounters() fails for new record saved with counter attribute not set 2015-04-21 16:23:00 +03:00
Jan Was
5f099b3f8d Merge branch 'master' into 7374-inserting-ar-without-values 2015-04-21 09:49:46 +02:00
Alexander Makarov
6949992246 Simplified tests directory structure a bit 2015-04-16 12:10:01 +03:00