$query->limit(10) gives fatal error
extend() isn't chain-able, it returns a new extended query object, so you need to assign the result back to the query object, e.g.

$query = $query-&gt;extend('PagerDefault')-&gt;limit(10);


Otherwise the query won't actually be extended and won't have the limit() method, hence the error you're getting.