Convert this SQL query to YYI2 orm query

SELECT * FROM chat WHERE (sender = 1079 AND reciever = 1) OR (sender = 1 AND reciever = 1079)

Hi @apanik, welcome to the forum.

Something like the following will do:

$one = 1;
$another = 1079;
$chats = Chat::find()->
    where(['or', 
        ['sender' => $one, 'receiver' => $another],
        ['sender' => $anoterh, 'receiver' => $one],
    ])->all();

This is an operator format query of OR that combines 2 sets of hash format queries.

https://www.yiiframework.com/doc/guide/2.0/en/db-query-builder#where