I’m trying to follow the guide to use a union query with a withQuery
$dispatchers = (new \yii\db\Query()) ->select(['DispatcherId', 'DispatcherName']) ->from('t1') ->withQuery( $queryProjectsDispatchers->union($queryLegsDispatchers), 't1', true) ->orderBy(['DispatcherName' => SORT_ASC]);
but keep getting the following error
Calling unknown method: yii\db\Query::withQuery()
which highlights the ->withQuery line of code.
What am I doing wrong?