I have a function in my
Event model called
getEvents - you can pass limit,
types, and event
I read that
paginate can accept all the parameters I'm using like
limit...etc just like a normal
It returns data just fine when I don't try to paginate. But - I'd like to be able to pass it a
paginate variable to tell it instead of doing this:
$this->recursive = -1; $data = $this->find('all', $qOptions);
to do this:
$this->recursive = -1; $data = $this->paginate($qOptions);
When I try that, though, it gives me lots of errors. I can specify the errors later if needed - for now, I guess I'm looking for - is this something that can be done? If so, how?
Is there another better way to do something like this? I spent enough time making this function do just what I want, and allowing all the options passed...etc - it just seems like a waste if I can't also use it for pagination. But - if it's not ideal, I'm ok hearing that too. Thanks in advance.
I'm reading other things online that say you shouldn't use paginate in your model, because it draws from URL variables, which defeats the MVC structure purpose. This makes sense, but does that mean I have to write the same joins/queries in both model and controller? And in every action that it's needed?