Способ 1. Не работает. Хорошо читается
Код: Выделить всё
$query->where([
'and',
['<', 'c2.lft', 'c0.lft'],
['>', 'c2.rgt', 'c0.rgt'],
['<>', 'c2.slug', 'root']
])
// WHERE (`c2`.`lft` < 'c0.lft') AND (`c2`.`rgt` > 'c0.rgt') AND (`c2`.`slug` <> 'root')
Код: Выделить всё
$query->where('c2.lft <= c0.lft AND c2.rgt >= c0.rgt AND c2.slug <> "root"')
// WHERE c2.lft <= c0.lft AND c2.rgt >= c0.rgt AND c2.slug <> "root"