On Mon, Jan 24, 2011 at 5:04 PM, mmamedov <[email protected]> wrote:
> cricket,
> It's not about just 'union'. I don't want to be dealing with cakephp
> style quering here. I am talking about plain sql query. Passing a pure
> mysql query into pagination.

As I said, 'union' was an arbitrary key. I chose it because your
original question seemed to be about using a UNION query for one
particular action's pagination. You can use whatever key you like.

> I did it, and it worked. The problem however is when I am trying to go
> with reqular CakePHP pagination within the same controller, for a
> differect action. Because when I override those 2 functions, they now
> work for all the actions in that controller (I overcame this problem
> as well-> in that controller I simply use plain sql in all
> paginations). Worked for me.

The point I'm trying to make is that, by making use of the $scope
param, you can test whether to do your special pagination or not. By
passing something in $scope that can be tested for in the $conditions
param within your model's pagination and paginationCount you create
the possibility to test, if/else, which pagination query to use.

> What I wonder is why not let people insert pure sql when needed into
> pagination, why force everyone to go through tedious cakephp style
> arraying sqls (with condition arrays, etc.)?


It's entirely possible. However, you then lose the built-in
functionality of the PaginationHelper.

> My method works, but how
> to enable or "disable" it per action of the same controller?

It's in the first example I posted.

-- 
Our newest site for the community: CakePHP Video Tutorials 
http://tv.cakephp.org 
Check out the new CakePHP Questions site http://ask.cakephp.org and help others 
with their CakePHP related questions.


To unsubscribe from this group, send email to
[email protected] For more options, visit this group at 
http://groups.google.com/group/cake-php

Reply via email to