@@ -48,10 +48,10 @@ public function testFindExists(): void
48
48
$ customerQuery = new ActiveQuery (Customer::class);
49
49
50
50
$ this ->assertTrue ($ customerQuery ->where (['[[id]] ' => 2 ])->exists ());
51
- $ this ->assertTrue ($ customerQuery ->where (['[[id]] ' => 2 ])->select ('[[name]] ' )->exists ());
51
+ $ this ->assertTrue ($ customerQuery ->setWhere (['[[id]] ' => 2 ])->select ('[[name]] ' )->exists ());
52
52
53
- $ this ->assertFalse ($ customerQuery ->where (['[[id]] ' => 42 ])->exists ());
54
- $ this ->assertFalse ($ customerQuery ->where (['[[id]] ' => 42 ])->select ('[[name]] ' )->exists ());
53
+ $ this ->assertFalse ($ customerQuery ->setWhere (['[[id]] ' => 42 ])->exists ());
54
+ $ this ->assertFalse ($ customerQuery ->setWhere (['[[id]] ' => 42 ])->select ('[[name]] ' )->exists ());
55
55
}
56
56
57
57
public function testFindColumn (): void
@@ -104,7 +104,7 @@ public function testFindLazyViaTable(): void
104
104
$ this ->assertCount (0 , $ orders ->getBooks ());
105
105
$ this ->assertEquals (2 , $ orders ->get ('id ' ));
106
106
107
- $ orders = $ orderQuery ->where (['id ' => 1 ])->asArray ()->one ();
107
+ $ orders = $ orderQuery ->setWhere (['id ' => 1 ])->asArray ()->one ();
108
108
$ this ->assertIsArray ($ orders );
109
109
}
110
110
@@ -234,7 +234,7 @@ public function testFind(): void
234
234
$ customer = $ customerQuery ->findOne (['id ' => [5 , 6 , 1 ]]);
235
235
$ this ->assertInstanceOf (Customer::class, $ customer );
236
236
237
- $ customer = $ customerQuery ->where (['id ' => [5 , 6 , 1 ]])->one ();
237
+ $ customer = $ customerQuery ->setWhere (['id ' => [5 , 6 , 1 ]])->one ();
238
238
$ this ->assertNotNull ($ customer );
239
239
240
240
/** find by column values */
@@ -380,9 +380,9 @@ public function testFindCount(): void
380
380
$ customerQuery = new ActiveQuery (Customer::class);
381
381
$ this ->assertEquals (3 , $ customerQuery ->count ());
382
382
$ this ->assertEquals (1 , $ customerQuery ->where (['id ' => 1 ])->count ());
383
- $ this ->assertEquals (2 , $ customerQuery ->where (['id ' => [1 , 2 ]])->count ());
384
- $ this ->assertEquals (2 , $ customerQuery ->where (['id ' => [1 , 2 ]])->offset (1 )->count ());
385
- $ this ->assertEquals (2 , $ customerQuery ->where (['id ' => [1 , 2 ]])->offset (2 )->count ());
383
+ $ this ->assertEquals (2 , $ customerQuery ->setWhere (['id ' => [1 , 2 ]])->count ());
384
+ $ this ->assertEquals (2 , $ customerQuery ->setWhere (['id ' => [1 , 2 ]])->offset (1 )->count ());
385
+ $ this ->assertEquals (2 , $ customerQuery ->setWhere (['id ' => [1 , 2 ]])->offset (2 )->count ());
386
386
387
387
$ customerQuery = new ActiveQuery (Customer::class);
388
388
$ this ->assertEquals (3 , $ customerQuery ->limit (1 )->count ());
@@ -455,27 +455,27 @@ public function testFindComplexCondition(): void
455
455
456
456
$ this ->assertCount (
457
457
2 ,
458
- $ customerQuery ->where (['OR ' , ['name ' => 'user1 ' ], ['name ' => 'user2 ' ]])->all ()
458
+ $ customerQuery ->setWhere (['OR ' , ['name ' => 'user1 ' ], ['name ' => 'user2 ' ]])->all ()
459
459
);
460
460
461
461
$ this ->assertEquals (
462
462
2 ,
463
- $ customerQuery ->where (['name ' => ['user1 ' , 'user2 ' ]])->count ()
463
+ $ customerQuery ->setWhere (['name ' => ['user1 ' , 'user2 ' ]])->count ()
464
464
);
465
465
466
466
$ this ->assertCount (
467
467
2 ,
468
- $ customerQuery ->where (['name ' => ['user1 ' , 'user2 ' ]])->all ()
468
+ $ customerQuery ->setWhere (['name ' => ['user1 ' , 'user2 ' ]])->all ()
469
469
);
470
470
471
471
$ this ->assertEquals (
472
472
1 ,
473
- $ customerQuery ->where (['AND ' , ['name ' => ['user2 ' , 'user3 ' ]], ['BETWEEN ' , 'status ' , 2 , 4 ]])->count ()
473
+ $ customerQuery ->setWhere (['AND ' , ['name ' => ['user2 ' , 'user3 ' ]], ['BETWEEN ' , 'status ' , 2 , 4 ]])->count ()
474
474
);
475
475
476
476
$ this ->assertCount (
477
477
1 ,
478
- $ customerQuery ->where (['AND ' , ['name ' => ['user2 ' , 'user3 ' ]], ['BETWEEN ' , 'status ' , 2 , 4 ]])->all ()
478
+ $ customerQuery ->setWhere (['AND ' , ['name ' => ['user2 ' , 'user3 ' ]], ['BETWEEN ' , 'status ' , 2 , 4 ]])->all ()
479
479
);
480
480
}
481
481
@@ -489,7 +489,7 @@ public function testFindNullValues(): void
489
489
$ customer ->setName (null );
490
490
$ customer ->save ();
491
491
492
- $ result = $ customerQuery ->where (['name ' => null ])->all ();
492
+ $ result = $ customerQuery ->setWhere (['name ' => null ])->all ();
493
493
$ this ->assertCount (1 , $ result );
494
494
$ this ->assertEquals (2 , reset ($ result )->getPrimaryKey ());
495
495
}
@@ -652,13 +652,13 @@ public function testFindEmptyInCondition(): void
652
652
$ customers = $ customerQuery ->where (['id ' => [1 ]])->all ();
653
653
$ this ->assertCount (1 , $ customers );
654
654
655
- $ customers = $ customerQuery ->where (['id ' => []])->all ();
655
+ $ customers = $ customerQuery ->setWhere (['id ' => []])->all ();
656
656
$ this ->assertCount (0 , $ customers );
657
657
658
- $ customers = $ customerQuery ->where (['IN ' , 'id ' , [1 ]])->all ();
658
+ $ customers = $ customerQuery ->setWhere (['IN ' , 'id ' , [1 ]])->all ();
659
659
$ this ->assertCount (1 , $ customers );
660
660
661
- $ customers = $ customerQuery ->where (['IN ' , 'id ' , []])->all ();
661
+ $ customers = $ customerQuery ->setWhere (['IN ' , 'id ' , []])->all ();
662
662
$ this ->assertCount (0 , $ customers );
663
663
}
664
664
@@ -675,7 +675,7 @@ public function testFindEagerIndexBy(): void
675
675
$ this ->assertTrue (isset ($ items [1 ]));
676
676
$ this ->assertTrue (isset ($ items [2 ]));
677
677
678
- $ order = $ orderQuery ->with ('itemsIndexed ' )->where (['id ' => 2 ])->one ();
678
+ $ order = $ orderQuery ->with ('itemsIndexed ' )->setWhere (['id ' => 2 ])->one ();
679
679
$ this ->assertTrue ($ order ->isRelationPopulated ('itemsIndexed ' ));
680
680
681
681
$ items = $ order ->getItemsIndexed ();
0 commit comments