File tree Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Expand file tree Collapse file tree 2 files changed +9
-4
lines changed Original file line number Diff line number Diff line change 33
33
namespace SQLParser \Node ;
34
34
35
35
use Doctrine \DBAL \Connection ;
36
+ use function is_iterable ;
36
37
use Mouf \MoufInstanceDescriptor ;
37
38
use Mouf \MoufManager ;
38
39
use SQLParser \Node \Traverser \NodeTraverser ;
@@ -263,10 +264,14 @@ public function walk(VisitorInterface $visitor)
263
264
*/
264
265
public function canBeBypassed (array $ parameters ): bool
265
266
{
266
- foreach ($ this ->subTree as $ node ) {
267
- if (!$ node instanceof BypassableInterface || !$ node ->canBeBypassed ($ parameters )) {
268
- return false ;
267
+ if (is_iterable ($ this ->subTree )) {
268
+ foreach ($ this ->subTree as $ node ) {
269
+ if (!$ node instanceof BypassableInterface || !$ node ->canBeBypassed ($ parameters )) {
270
+ return false ;
271
+ }
269
272
}
273
+ } elseif (!$ this ->subTree instanceof BypassableInterface || !$ this ->subTree ->canBeBypassed ($ parameters )) {
274
+ return false ;
270
275
}
271
276
return true ;
272
277
}
Original file line number Diff line number Diff line change @@ -179,7 +179,7 @@ public function testStandardSelect()
179
179
$ this ->assertEquals ('SELECT a FROM users AS u CROSS JOIN users AS u2 ' , self ::simplifySql ($ magicQuery ->build ($ sql )));
180
180
181
181
$ sql = 'SELECT a FROM users u WHERE status = (CASE WHEN u.id = 1 THEN u.status_1 ELSE u.status_2 END) ' ;
182
- $ this ->assertEquals ('foo ' , self ::simplifySql ($ magicQuery ->build ($ sql )));
182
+ $ this ->assertEquals ('SELECT a FROM users AS u WHERE status = (CASE WHEN u.id = 1 THEN u.status_1 ELSE u.status_2 END) ' , self ::simplifySql ($ magicQuery ->build ($ sql )));
183
183
}
184
184
185
185
/**
You can’t perform that action at this time.
0 commit comments