@@ -90,44 +90,53 @@ private function getAccessMode(string $accessModeData): AccessMode
90
90
91
91
private function buildProfiledQueryPlan (?array $ queryPlanData ): ?ProfiledQueryPlan
92
92
{
93
-
94
93
if ($ queryPlanData === null || empty ($ queryPlanData )) {
95
94
return null ;
96
95
}
97
96
98
97
/**
99
98
* @var array<string, mixed> $mappedArguments
100
99
*/
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
104
109
}
105
110
return $ value ;
106
111
}, $ queryPlanData ['arguments ' ] ?? []);
107
112
108
113
$ queryArguments = new ProfiledQueryPlanArguments (
109
114
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 ' ] ?? []
129
139
);
130
- $ children = array_map (fn ($ child ) => $ this ->buildProfiledQueryPlan ($ child ), $ queryPlanData ['children ' ] ?? []);
131
140
132
141
return new ProfiledQueryPlan (
133
142
$ queryPlanData ['dbHits ' ] ?? 0 ,
@@ -143,4 +152,5 @@ private function buildProfiledQueryPlan(?array $queryPlanData): ?ProfiledQueryPl
143
152
$ queryPlanData ['identifiers ' ] ?? []
144
153
);
145
154
}
155
+
146
156
}
0 commit comments