There is a pagination feature, which is built-in in 2.2, and does something similar to what you're seeking:
But I do not believe it uses SQL_CALC_FOUND_ROWS
: it does two (or three, depending on how you configure it) separate queries to get the results, and that is frequently the correct way to proceed.
If you really insist on using the MySQL feature, I think you need to use raw SQL and a result set mapping. Here's an example:
On a completely separate note, test whether SQL_CALC_FOUND_ROWS
is actually worth using for your particular query. Count is well optimized in MySQL for queries like the one you're doing. See this question in particular:
Which is fastest? SELECT SQL_CALC_FOUND_ROWS FROM `table`, or SELECT COUNT(*)