@@ -198,6 +198,8 @@ public function testEmulatesFullOuterJoinRemapsQualifiedUnionColumns(): void
198198 'table_main._createdAt ' => '2020-01-01 00:00:00.000 ' ,
199199 'table_main._updatedAt ' => '2020-01-01 00:00:00.000 ' ,
200200 'table_main.name ' => 'Alice ' ,
201+ 'orders._uid ' => 'order1 ' ,
202+ 'orders._permissions ' => '["read"] ' ,
201203 'foj_ord_0 ' => 1 ,
202204 ],
203205 ]);
@@ -220,6 +222,40 @@ public function testEmulatesFullOuterJoinRemapsQualifiedUnionColumns(): void
220222 $ this ->assertSame ('Alice ' , $ results [0 ]->getAttribute ('name ' ));
221223 $ this ->assertSame (false , $ results [0 ]->isSet ('foj_ord_0 ' ));
222224 $ this ->assertSame (false , $ results [0 ]->isSet ('table_main._uid ' ));
225+ $ this ->assertSame ('order1 ' , $ results [0 ]->getAttribute ('orders.$id ' ));
226+ $ this ->assertSame (['read ' ], $ results [0 ]->getAttribute ('orders.$permissions ' ));
227+ $ this ->assertSame (false , $ results [0 ]->isSet ('orders._uid ' ));
228+ }
229+
230+ public function testQualifyDottedAttributeKeepsNestedObjectPaths (): void
231+ {
232+ $ adapter = new MySQL ($ this ->getMockBuilder (\PDO ::class)->disableOriginalConstructor ()->getMock ());
233+ $ method = new ReflectionMethod (MySQL::class, 'qualifyDottedAttribute ' );
234+
235+ $ aliasSet = [
236+ Query::DEFAULT_ALIAS => true ,
237+ 'orders ' => true ,
238+ ];
239+ $ mainAttributes = [
240+ 'meta.score ' => true ,
241+ ];
242+
243+ $ this ->assertSame (
244+ 'metascore ' ,
245+ $ method ->invoke ($ adapter , 'meta.score ' , $ aliasSet , $ mainAttributes )
246+ );
247+ $ this ->assertSame (
248+ 'orders.email ' ,
249+ $ method ->invoke ($ adapter , 'orders.email ' , $ aliasSet , $ mainAttributes )
250+ );
251+ $ this ->assertSame (
252+ 'orders._uid ' ,
253+ $ method ->invoke ($ adapter , 'orders.$id ' , $ aliasSet , $ mainAttributes )
254+ );
255+ $ this ->assertSame (
256+ 'profile.user.email ' ,
257+ $ method ->invoke ($ adapter , 'profile.user.email ' , $ aliasSet , $ mainAttributes )
258+ );
223259 }
224260
225261 /**
0 commit comments