Is there a reason in my query single quotes are not being removed?

I have a subquery where the generated raw sql has single quotes on it, but I can’t remove them before because it would not work either. This is my query


                    ->from('`message` `o`')

                    ->join('LEFT JOIN', '`message` `b`', ['and',['or', 

                            ['and', ['=', '`o`.`order_id`', '`b`.`order_id`'],['is', '`o`.`saved_search_id`', NULL]],

                            ['and', ['=', '`o`.`saved_search_id`', '`b`.`saved_search_id`'],['is', '`o`.`order_id`', NULL]]


                        ['and',['=', '`o`.`message_owner_user_id`', '`b`.`message_owner_user_id`'], ['<', '`o`.`created_at`', '`b`.`created_at`']   ]])

                    ->where(['is', '`b`.`id`', NULL])

                    ->andWhere(['`o`.`message_owner_user_id`' => $user->id])

                    ->orderBy(['`o`.`created_at`' => SORT_DESC]);

This is my raw sql result:

SELECT `m`.* 
FROM (SELECT `o`.* FROM `message` `o` 
LEFT JOIN `message` `b` ON (((`o`.`order_id` = '`b`.`order_id`') AND (`o`.`saved_search_id` IS NULL)) 
OR ((`o`.`saved_search_id` = '`b`.`saved_search_id`') AND (`o`.`order_id` IS NULL))) 
AND ((`o`.`message_owner_user_id` = '`b`.`message_owner_user_id`') AND (`o`.`created_at` < '`b`.`created_at`')) 
WHERE (`b`.`id` IS NULL) AND (`o`.`message_owner_user_id`=1446) 
ORDER BY `o`.`created_at` DESC) `m` 

Please ignore the first Select m.*, because it is a subquery, so it starts after the first ‘FROM’. Notice that before the b, there are single quotes. Why is that? The last has no single quote though.

Already tried removing single quotes from the yii2, but that makes the data dissappear completely. For example: ‘`o`.`order_id`’ turns into emptiness.

Solved it using a raw query.

Instead of join(‘LEFT JOIN’, ’message b', [\the conditions])

I tried this and worked join(‘LEFT JOIN’, ’message b', ‘…raw query here…’).