@@ -905,7 +905,7 @@ public function testInnerJoinBasic(): void
905905 $ this ->createCustomers ($ database , 'ij_customers ' );
906906
907907 $ results = $ database ->find ('ij_orders ' , [
908- Query::join ('ij_customers ' , 'customer_uid ' , '$id ' ),
908+ Query::join ('ij_customers ' , 'j0 ' , [Query:: on ( ' customer_uid ' , '$id ' )] ),
909909 Query::count ('* ' , 'total ' ),
910910 ]);
911911
@@ -927,7 +927,7 @@ public function testInnerJoinWithGroupBy(): void
927927 $ this ->createCustomers ($ database , 'ij_grp_c ' );
928928
929929 $ results = $ database ->find ('ij_grp_o ' , [
930- Query::join ('ij_grp_c ' , 'customer_uid ' , '$id ' ),
930+ Query::join ('ij_grp_c ' , 'j0 ' , [Query:: on ( ' customer_uid ' , '$id ' )] ),
931931 Query::sum ('total ' , 'total_spent ' ),
932932 Query::count ('* ' , 'order_count ' ),
933933 Query::groupBy (['customer_uid ' ]),
@@ -960,7 +960,7 @@ public function testInnerJoinWithFilter(): void
960960 $ this ->createCustomers ($ database , 'ij_filt_c ' );
961961
962962 $ results = $ database ->find ('ij_filt_o ' , [
963- Query::join ('ij_filt_c ' , 'customer_uid ' , '$id ' ),
963+ Query::join ('ij_filt_c ' , 'j0 ' , [Query:: on ( ' customer_uid ' , '$id ' )] ),
964964 Query::equal ('status ' , ['completed ' ]),
965965 Query::sum ('total ' , 'revenue ' ),
966966 Query::groupBy (['customer_uid ' ]),
@@ -992,7 +992,7 @@ public function testInnerJoinWithHaving(): void
992992 $ this ->createCustomers ($ database , 'ij_hav_c ' );
993993
994994 $ results = $ database ->find ('ij_hav_o ' , [
995- Query::join ('ij_hav_c ' , 'customer_uid ' , '$id ' ),
995+ Query::join ('ij_hav_c ' , 'j0 ' , [Query:: on ( ' customer_uid ' , '$id ' )] ),
996996 Query::sum ('total ' , 'total_spent ' ),
997997 Query::groupBy (['customer_uid ' ]),
998998 Query::having ([Query::greaterThan ('total_spent ' , 1000 )]),
@@ -1019,7 +1019,7 @@ public function testInnerJoinProductReviewStats(): void
10191019 $ this ->createReviews ($ database , 'ij_prs_r ' );
10201020
10211021 $ results = $ database ->find ('ij_prs_p ' , [
1022- Query::join ('ij_prs_r ' , '$id ' , 'product_uid ' ),
1022+ Query::join ('ij_prs_r ' , 'j0 ' , [Query:: on ( ' $id ' , 'product_uid ' )] ),
10231023 Query::count ('* ' , 'review_count ' ),
10241024 Query::avg ('score ' , 'avg_score ' ),
10251025 Query::groupBy (['name ' ]),
@@ -1052,7 +1052,7 @@ public function testLeftJoinBasic(): void
10521052 $ this ->createReviews ($ database , 'lj_basic_r ' );
10531053
10541054 $ results = $ database ->find ('lj_basic_p ' , [
1055- Query::leftJoin ('lj_basic_r ' , '$id ' , 'product_uid ' ),
1055+ Query::leftJoin ('lj_basic_r ' , 'j0 ' , [Query:: on ( ' $id ' , 'product_uid ' )] ),
10561056 Query::count ('* ' , 'review_count ' ),
10571057 Query::groupBy (['name ' ]),
10581058 ]);
@@ -1086,7 +1086,7 @@ public function testLeftJoinWithFilter(): void
10861086 $ this ->createOrders ($ database , 'lj_filt_o ' );
10871087
10881088 $ results = $ database ->find ('lj_filt_p ' , [
1089- Query::leftJoin ('lj_filt_o ' , '$id ' , 'product_uid ' ),
1089+ Query::leftJoin ('lj_filt_o ' , 'j0 ' , [Query:: on ( ' $id ' , 'product_uid ' )] ),
10901090 Query::equal ('category ' , ['electronics ' ]),
10911091 Query::count ('* ' , 'order_count ' ),
10921092 Query::sum ('quantity ' , 'total_qty ' ),
@@ -1119,7 +1119,7 @@ public function testLeftJoinCustomerOrderSummary(): void
11191119 $ this ->createOrders ($ database , 'lj_cos_o ' );
11201120
11211121 $ results = $ database ->find ('lj_cos_c ' , [
1122- Query::leftJoin ('lj_cos_o ' , '$id ' , 'customer_uid ' ),
1122+ Query::leftJoin ('lj_cos_o ' , 'j0 ' , [Query:: on ( ' $id ' , 'customer_uid ' )] ),
11231123 Query::count ('* ' , 'order_count ' ),
11241124 Query::groupBy (['name ' ]),
11251125 ]);
@@ -1187,7 +1187,7 @@ public function testJoinAggregationWithPermissionsGrouped(): void
11871187 $ database ->getAuthorization ()->addRole (Role::user ('viewer ' )->toString ());
11881188
11891189 $ results = $ database ->find ('jp_apg_o ' , [
1190- Query::join ('jp_apg_c ' , 'customer_uid ' , '$id ' ),
1190+ Query::join ('jp_apg_c ' , 'j0 ' , [Query:: on ( ' customer_uid ' , '$id ' )] ),
11911191 Query::sum ('amount ' , 'total ' ),
11921192 Query::count ('* ' , 'cnt ' ),
11931193 Query::groupBy (['customer_uid ' ]),
@@ -1248,7 +1248,7 @@ public function testLeftJoinPermissionFiltered(): void
12481248 $ database ->getAuthorization ()->addRole (Role::user ('tester ' )->toString ());
12491249
12501250 $ results = $ database ->find ('jp_ljpf_p ' , [
1251- Query::leftJoin ('jp_ljpf_r ' , '$id ' , 'product_uid ' ),
1251+ Query::leftJoin ('jp_ljpf_r ' , 'j0 ' , [Query:: on ( ' $id ' , 'product_uid ' )] ),
12521252 Query::count ('* ' , 'review_count ' ),
12531253 Query::groupBy (['name ' ]),
12541254 ]);
@@ -2111,10 +2111,10 @@ public function testMainAttributeAggregatedUnderItsOwnNameOverAJoinIsReadFromThe
21112111 }
21122112
21132113 foreach ([
2114- 'inner join ' => [Query::join ($ joined , 'link ' , 'link ' , '= ' , ' other ' ), 10 , 1 ],
2115- 'left join ' => [Query::leftJoin ($ joined , 'link ' , 'link ' , '= ' , ' other ' ), 30 , 2 ],
2116- 'right join ' => [Query::rightJoin ($ joined , 'link ' , 'link ' , '= ' , ' other ' ), 10 , 2 ],
2117- 'full outer join ' => [Query::fullOuterJoin ($ joined , 'link ' , 'link ' , '= ' , ' other ' ), 30 , 3 ],
2114+ 'inner join ' => [Query::join ($ joined , 'other ' , [Query:: on ( 'link ' , 'link ' )] ), 10 , 1 ],
2115+ 'left join ' => [Query::leftJoin ($ joined , 'other ' , [Query:: on ( 'link ' , 'link ' )] ), 30 , 2 ],
2116+ 'right join ' => [Query::rightJoin ($ joined , 'other ' , [Query:: on ( 'link ' , 'link ' )] ), 10 , 2 ],
2117+ 'full outer join ' => [Query::fullOuterJoin ($ joined , 'other ' , [Query:: on ( 'link ' , 'link ' )] ), 30 , 3 ],
21182118 ] as $ type => [$ join , $ total , $ rows ]) {
21192119 $ own = $ database ->find ($ main , [$ join , Query::sum ('score ' , 'score ' )]);
21202120 $ this ->assertCount (1 , $ own , $ type );
@@ -2208,7 +2208,7 @@ public function testSelectNextToAnAggregateMustNameAGroupedAttribute(): void
22082208 if ($ database ->getAdapter ()->supports (Capability::Joins)) {
22092209 $ orders = 'agg_select_ungrouped_orders ' ;
22102210 $ this ->createOrders ($ database , $ orders );
2211- $ product = Query::join ($ collection , 'product_uid ' , ' $id ' , '= ' , ' product ' );
2211+ $ product = Query::join ($ collection , 'product ' , [Query:: on ( ' product_uid ' , '$id ' )] );
22122212
22132213 foreach ([
22142214 ['product.name ' , [$ product , Query::count ('* ' , 'total ' ), Query::groupBy (['status ' ]), Query::select (['product.name ' ])]],
@@ -2293,7 +2293,7 @@ public function testRelationshipWildcardsNextToAnAggregateAddNothingToTheRows():
22932293 $ this ->assertSame (['status ' , 'total ' ], $ this ->sortedAttributeNames ($ groups [0 ]));
22942294
22952295 if ($ adapter ->supports (Capability::Joins)) {
2296- $ joined = $ database ->find ($ customers , [Query::fullOuterJoin ($ accounts , 'account ' , ' $id ' , '= ' , ' owned ' ), Query::count ('* ' , 'total ' ), Query::select ($ selects )]);
2296+ $ joined = $ database ->find ($ customers , [Query::fullOuterJoin ($ accounts , 'owned ' , [Query:: on ( ' account ' , '$id ' )] ), Query::count ('* ' , 'total ' ), Query::select ($ selects )]);
22972297 $ this ->assertCount (1 , $ joined );
22982298 $ this ->assertSame (['total ' ], $ this ->sortedAttributeNames ($ joined [0 ]));
22992299 $ this ->assertSame (3 , $ this ->intAttribute ($ joined [0 ], 'total ' ));
@@ -2335,8 +2335,8 @@ public function testGroupedSelectReturnsEachGroupOnceWithItsAggregate(): void
23352335 $ this ->createOrders ($ database , $ orders );
23362336
23372337 foreach ([
2338- 'inner join ' => [Query::join ($ collection , 'product_uid ' , ' $id ' , '= ' , ' product ' ), [2 , 3 , 5 ]],
2339- 'full outer join ' => [Query::fullOuterJoin ($ collection , 'product_uid ' , ' $id ' , '= ' , ' product ' ), [3 , 3 , 5 ]],
2338+ 'inner join ' => [Query::join ($ collection , 'product ' , [Query:: on ( ' product_uid ' , '$id ' )] ), [2 , 3 , 5 ]],
2339+ 'full outer join ' => [Query::fullOuterJoin ($ collection , 'product ' , [Query:: on ( ' product_uid ' , '$id ' )] ), [3 , 3 , 5 ]],
23402340 ] as $ type => [$ product , $ totals ]) {
23412341 $ groups = $ database ->find ($ orders , [$ product , Query::count ('* ' , 'total ' ), Query::groupBy (['product.category ' ]), Query::select (['product.category ' ]), Query::orderAsc ('product.category ' )]);
23422342 $ this ->assertSame (['books ' , 'clothing ' , 'electronics ' ], \array_map (fn (Document $ group ): mixed => $ group ->getAttribute ('category ' ), $ groups ), $ type );
0 commit comments