@@ -90,44 +90,53 @@ private function getAccessMode(string $accessModeData): AccessMode
9090
9191 private function buildProfiledQueryPlan (?array $ queryPlanData ): ?ProfiledQueryPlan
9292 {
93-
9493 if ($ queryPlanData === null || empty ($ queryPlanData )) {
9594 return null ;
9695 }
9796
9897 /**
9998 * @var array<string, mixed> $mappedArguments
10099 */
101- $ mappedArguments = array_map (function ($ value ): mixed {
102- if (is_array ($ value ) && array_key_exists ('$type ' , $ value ) && array_key_exists ('_value ' , $ value )) {
103- return $ this ->ogm ->map ($ value );
100+ $ mappedArguments = array_map (function (array $ value ): mixed {
101+ if (
102+ isset ($ value ['$type ' ], $ value ['_value ' ]) &&
103+ is_string ($ value ['$type ' ])
104+ ) {
105+ return $ this ->ogm ->map ([
106+ '$type ' => $ value ['$type ' ],
107+ '_value ' => $ value ['_value ' ]
108+ ]); // ✅ Pass only expected keys
104109 }
105110 return $ value ;
106111 }, $ queryPlanData ['arguments ' ] ?? []);
107112
108113 $ queryArguments = new ProfiledQueryPlanArguments (
109114 globalMemory: $ mappedArguments ['GlobalMemory ' ] ?? null ,
110- plannerImpl: $ mappedArguments ['planner-impl ' ] ?? null , //('planner-impl', $mappedArguments) ? $mappedArguments['planner-impl'] : null,
111- memory: array_key_exists ('Memory ' , $ mappedArguments ) ? $ mappedArguments ['Memory ' ] : null ,
112- stringRepresentation: array_key_exists ('string-representation ' , $ mappedArguments ) ? $ mappedArguments ['string-representation ' ] : null ,
113- runtime: array_key_exists ('runtime ' , $ mappedArguments ) ? $ mappedArguments ['runtime ' ] : null ,
114- time: array_key_exists ('Time ' , $ mappedArguments ) ? $ mappedArguments ['Time ' ] : null ,
115- pageCacheMisses: array_key_exists ('PageCacheMisses ' , $ mappedArguments ) ? $ mappedArguments ['PageCacheMisses ' ] : null ,
116- pageCacheHits: array_key_exists ('PageCacheHits ' , $ mappedArguments ) ? $ mappedArguments ['PageCacheHits ' ] : null ,
117- runtimeImpl: array_key_exists ('runtime-impl ' , $ mappedArguments ) ? $ mappedArguments ['runtime-impl ' ] : null ,
118- version: array_key_exists ('version ' , $ mappedArguments ) ? $ mappedArguments ['version ' ] : null ,
119- dbHits: array_key_exists ('DbHits ' , $ mappedArguments ) ? $ mappedArguments ['DbHits ' ] : null ,
120- batchSize: array_key_exists ('batch-size ' , $ mappedArguments ) ? $ mappedArguments ['batch-size ' ] : null ,
121- details: array_key_exists ('Details ' , $ mappedArguments ) ? $ mappedArguments ['Details ' ] : null ,
122- plannerVersion: array_key_exists ('planner-version ' , $ mappedArguments ) ? $ mappedArguments ['planner-version ' ] : null ,
123- pipelineInfo: array_key_exists ('PipelineInfo ' , $ mappedArguments ) ? $ mappedArguments ['PipelineInfo ' ] : null ,
124- runtimeVersion: array_key_exists ('runtime-version ' , $ mappedArguments ) ? $ mappedArguments ['runtime-version ' ] : null ,
125- id: array_key_exists ('Id ' , $ mappedArguments ) ? $ mappedArguments ['Id ' ] : null ,
126- estimatedRows: array_key_exists ('EstimatedRows ' , $ mappedArguments ) ? $ mappedArguments ['EstimatedRows ' ] : null ,
127- planner: array_key_exists ('planner ' , $ mappedArguments ) ? $ mappedArguments ['planner ' ] : null ,
128- rows: array_key_exists ('Rows ' , $ mappedArguments ) ? $ mappedArguments ['Rows ' ] : null
115+ plannerImpl: $ mappedArguments ['planner-impl ' ] ?? null ,
116+ memory: $ mappedArguments ['Memory ' ] ?? null ,
117+ stringRepresentation: $ mappedArguments ['string-representation ' ] ?? null ,
118+ runtime: $ mappedArguments ['runtime ' ] ?? null ,
119+ time: $ mappedArguments ['Time ' ] ?? null ,
120+ pageCacheMisses: $ mappedArguments ['PageCacheMisses ' ] ?? null ,
121+ pageCacheHits: $ mappedArguments ['PageCacheHits ' ] ?? null ,
122+ runtimeImpl: $ mappedArguments ['runtime-impl ' ] ?? null ,
123+ version: $ mappedArguments ['version ' ] ?? null ,
124+ dbHits: $ mappedArguments ['DbHits ' ] ?? null ,
125+ batchSize: $ mappedArguments ['batch-size ' ] ?? null ,
126+ details: $ mappedArguments ['Details ' ] ?? null ,
127+ plannerVersion: $ mappedArguments ['planner-version ' ] ?? null ,
128+ pipelineInfo: $ mappedArguments ['PipelineInfo ' ] ?? null ,
129+ runtimeVersion: $ mappedArguments ['runtime-version ' ] ?? null ,
130+ id: $ mappedArguments ['Id ' ] ?? null ,
131+ estimatedRows: $ mappedArguments ['EstimatedRows ' ] ?? null ,
132+ planner: $ mappedArguments ['planner ' ] ?? null ,
133+ rows: $ mappedArguments ['Rows ' ] ?? null
134+ );
135+
136+ $ children = array_map (
137+ fn (array $ child ): ?ProfiledQueryPlan => $ this ->buildProfiledQueryPlan ($ child ),
138+ $ queryPlanData ['children ' ] ?? []
129139 );
130- $ children = array_map (fn ($ child ) => $ this ->buildProfiledQueryPlan ($ child ), $ queryPlanData ['children ' ] ?? []);
131140
132141 return new ProfiledQueryPlan (
133142 $ queryPlanData ['dbHits ' ] ?? 0 ,
@@ -143,4 +152,5 @@ private function buildProfiledQueryPlan(?array $queryPlanData): ?ProfiledQueryPl
143152 $ queryPlanData ['identifiers ' ] ?? []
144153 );
145154 }
155+
146156}
0 commit comments