Query expressions add new with AND and OR

I try to create and chain expression with different conjunction, but it seems I do not undertood how does it work.

$e = new QueryExpression();
$e->add(['OR' => '1=2']);
$e->add(['AND' => '7=8']);

The result of the abode is (1=2 AND 3=4 AND 5=6 AND 7=8)

Ho do I add AND and OR conjunctions?

there was orWhere() and andWhere() which I was use

but there is also info that they are deprecated.

The way I found is that you have to create a new QueryExpression for every part of it

    ->eq(1, 2)
        $query->newExpr('3 = 4')
            ->add($query->newExpr()->eq(5, 6))
    ->add($query->newExpr('7 = 8');
1 Like