File tree Expand file tree Collapse file tree 3 files changed +31
-14
lines changed Expand file tree Collapse file tree 3 files changed +31
-14
lines changed Original file line number Diff line number Diff line change 11# Changelog
22All notable changes to this project will be documented in this file.
33
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+
48## [ 4.1.2]
59
610* 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 2222use MongoDB \BSON \Regex ;
2323use MongoDB \BSON \UTCDateTime ;
2424use MongoDB \Driver \Cursor ;
25+ use Override ;
2526use RuntimeException ;
2627
2728use function array_fill_keys ;
3738use function call_user_func_array ;
3839use function count ;
3940use function ctype_xdigit ;
41+ use function dd ;
42+ use function dump ;
4043use function end ;
4144use function explode ;
4245use function func_get_args ;
@@ -250,6 +253,30 @@ public function cursor($columns = [])
250253 throw new RuntimeException ('Query not compatible with cursor ' );
251254 }
252255
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+
253280 /**
254281 * Return the MongoDB query to be run in the form of an element array like ['method' => [arguments]].
255282 *
Original file line number Diff line number Diff line change @@ -89,19 +89,5 @@ public static function provideUnsupportedMethods(): Generator
8989 'This method is not supported by MongoDB. Try "toMql()" instead ' ,
9090 [[['name ' => 'Jane ' ]], fn (QueryBuilder $ builder ) => $ builder ],
9191 ];
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- ];
10692 }
10793}
You can’t perform that action at this time.
0 commit comments