I build a website application using Yii Framework.
I want to use model with query like this:
SELECT u.id, u.username, u.score, (SELECT COUNT(ownerId) FROM post p WHERE p.ownerId = u.id) AS totalPost
FROM users u
ORDER BY u.score DESC, totalPost DESC LIMIT 10
Please help me to convert the query into models in Yii Framework ...