I have query like this:
SELECT * FROM activity
WHERE (((userId = 1 OR userId IN(SELECT userId FROM follower WHERE followerId = 1))
AND activityType IN(1, 2, 3))
OR (targetId = 24 AND aType IN(1, 2, 3, 4, 5)))
ORDER BY id DESC;
I have try to use model()->findAllBySql($sql)
and it works. But I want to make it using CDbCriteria
, if you have another solutions let me know it :D