I have this situation where I have a complex query that is easier to handle with findAllBySql.
Now my problem is that I can’t use Pagination, maybe I am missing something.
I can’t seem to be able to apply the limit, so I get all the records in my query.
$total = anuncio::model()->countBySql($q);
$paginas = new CPagination($total);
$paginas->pageSize = 10;
$paginas->applyLimit($q); // <-- how do I apply the limit to my sql statement?
$anuncios = anuncio::model()->findAllBySql($q);