Re: Pagination with 2nd order recursive conditions filter

2010-01-13 Thread John Andersen
You are welcome :) I just have a lot of HABTM relationships, but I have no wish to define all these joins. It is kind of non-object oriented solution, that the controller needs to know how to define relationships/joins for pagination. My change to Containable mostly ensures that I can make condit

Re: Pagination with 2nd order recursive conditions filter

2010-01-13 Thread thomaus
Thanks for your help. You method perfectly works (unless the OR condition with pagination filters) but I think the smartest way (and simpliest way) to do is the one I found in this blog: http://cakebaker.42dh.com/2007/10/17/pagination-of-data-from-a-habtm-relationship/ But still, Cake should let t

Re: Pagination with 2nd order recursive conditions filter

2010-01-12 Thread John Andersen
Hej Thomaus, I have a modified Containable behaviour, that may help you solve your problem. Find it here http://bin.cakephp.org/view/763226357 and place it in your app/models/behaviours directory, it will then replace the CakePHP Containable behaviour. I can now make finds that looks like: [code

Re: Pagination with 2nd order recursive conditions filter

2010-01-12 Thread thomaus
I can't believe there are no solution to this problem. I mean, it's just paginating a model with a second order filter! HELP! HELP! HELP! This is urgent! On Jan 11, 8:50 am, Fran Iglesias wrote: > Hi, > El 11/01/2010, a las 8:35, Jeremy Burns escribió: > > > I have had the very same annoying pro

Re: Pagination with 2nd order recursive conditions filter

2010-01-10 Thread Fran Iglesias
Hi, El 11/01/2010, a las 8:35, Jeremy Burns escribió: I have had the very same annoying problem and couldn't solve it. I wanted to do (effectively - using the good old blog as an example): If you are writing your custom find types to perform the search as in http://rafaelbandeira3.wordpress.

Re: Pagination with 2nd order recursive conditions filter

2010-01-10 Thread Jeremy Burns
I have had the very same annoying problem and couldn't solve it. I wanted to do (effectively - using the good old blog as an example): SELECT author.id, author.name, COUNT(articles.id) AS article_count FROM authors left join articles on articles.author_id = authors.id; I wanted this for an inde

Re: Pagination with 2nd order recursive conditions filter

2010-01-10 Thread loke
I am facing the exact same problem. I want to filter the results on the basis of a one-to-many relationship. But it would not accept any form of model filter, Parent.Child.fieldName or Child.fieldName even though the model relations are well defined. It tries to search the parent table for the fiel

Re: Pagination with 2nd order recursive conditions filter

2009-12-27 Thread thomaus
Hi John, Thanks for helping but still no luck. I get this (expected) error : Warning (512): SQL Error: 1054: Unknown column 'User.parent_id' in 'where clause' [/Users/thomas/Sites/Cake/1.2.5/cake/libs/model/ datasources/dbo_source.php, line 525] Query: SELECT COUNT(*) AS `count` FROM `campaigns`

Re: Pagination with 2nd order recursive conditions filter

2009-12-26 Thread John Andersen
Try to just specify: $this->Campaign->recursive = 3; $filter = array('User.parent_id = ' => 204); /* Changed this */ $campaigns = $this->paginate(null, $filter); Enjoy, John On Dec 19, 3:43 am, thomaus wrote: > Hi, > > I have to do a 2nd order filter por pagination. > > My pagination var: >

Re: Pagination with 2nd order recursive conditions filter

2009-12-26 Thread thomaus
I can't believe nobody knows how to do that. I'm pretty sure somebody has ever experienced this issue and knows how to solve it. Please, help me! :-) On Dec 21, 9:06 am, thomaus wrote: > Nobody no clue? > > On Dec 19, 2:43 am,thomaus wrote: > > > Hi, > > > I have to do a 2nd order filter por pag

Re: Pagination with 2nd order recursive conditions filter

2009-12-21 Thread thomaus
Nobody no clue? On Dec 19, 2:43 am, thomaus wrote: > Hi, > > I have to do a 2nd order filter por pagination. > > My pagination var: > > var $paginate = array( >         'limit' => 10, >         'fields' => array('Campaign.id', 'Campaign.name', > 'Campaign.description'), >         'order' => array