File tree 3 files changed +31
-14
lines changed
3 files changed +31
-14
lines changed Original file line number Diff line number Diff line change 1
1
# Changelog
2
2
All notable changes to this project will be documented in this file.
3
3
4
+ ## [ unreleased]
5
+
6
+ * Fix ` Query\Builder::dump ` and ` dd ` methods to dump the MongoDB query by @GromNaN in [ #2727 ] ( https://github.com/mongodb/laravel-mongodb/pull/2727 )
7
+
4
8
## [ 4.1.2]
5
9
6
10
* Fix support for subqueries using the query builder by @GromNaN in [ #2717 ] ( https://github.com/mongodb/laravel-mongodb/pull/2717 )
Original file line number Diff line number Diff line change 22
22
use MongoDB \BSON \Regex ;
23
23
use MongoDB \BSON \UTCDateTime ;
24
24
use MongoDB \Driver \Cursor ;
25
+ use Override ;
25
26
use RuntimeException ;
26
27
27
28
use function array_fill_keys ;
37
38
use function call_user_func_array ;
38
39
use function count ;
39
40
use function ctype_xdigit ;
41
+ use function dd ;
42
+ use function dump ;
40
43
use function end ;
41
44
use function explode ;
42
45
use function func_get_args ;
@@ -250,6 +253,30 @@ public function cursor($columns = [])
250
253
throw new RuntimeException ('Query not compatible with cursor ' );
251
254
}
252
255
256
+ /**
257
+ * Die and dump the current MongoDB query
258
+ *
259
+ * @return never-return
260
+ */
261
+ #[Override]
262
+ public function dd ()
263
+ {
264
+ dd ($ this ->toMql ());
265
+ }
266
+
267
+ /**
268
+ * Dump the current MongoDB query
269
+ *
270
+ * @return $this
271
+ */
272
+ #[Override]
273
+ public function dump ()
274
+ {
275
+ dump ($ this ->toMql ());
276
+
277
+ return $ this ;
278
+ }
279
+
253
280
/**
254
281
* Return the MongoDB query to be run in the form of an element array like ['method' => [arguments]].
255
282
*
Original file line number Diff line number Diff line change @@ -89,19 +89,5 @@ public static function provideUnsupportedMethods(): Generator
89
89
'This method is not supported by MongoDB. Try "toMql()" instead ' ,
90
90
[[['name ' => 'Jane ' ]], fn (QueryBuilder $ builder ) => $ builder ],
91
91
];
92
-
93
- yield 'dd ' => [
94
- 'dd ' ,
95
- BadMethodCallException::class,
96
- 'This method is not supported by MongoDB. Try "toMql()" instead ' ,
97
- [[['name ' => 'Jane ' ]], fn (QueryBuilder $ builder ) => $ builder ],
98
- ];
99
-
100
- yield 'dump ' => [
101
- 'dump ' ,
102
- BadMethodCallException::class,
103
- 'This method is not supported by MongoDB. Try "toMql()" instead ' ,
104
- [[['name ' => 'Jane ' ]], fn (QueryBuilder $ builder ) => $ builder ],
105
- ];
106
92
}
107
93
}
You can’t perform that action at this time.
0 commit comments