Re: Pagination $this->Model->query()

2009-08-17 Thread gjofum
Maybe you're right. But even I can't make silimar cakephp find method to my own sql code. For example: If I use brian's code above I got error: Unknown column 'ItemContent.language_id' in 'where clause'. It's because table ItemContent is just used at 2. query. And I do not know how to set conditi

Re: Pagination $this->Model->query()

2009-08-17 Thread Miles J
The funny thing is, 2 queries compared to 1 doesn't make a difference. You have a problem when you are reaching 1000 queries. I honestly don't see a problem with a few extra queries as it doesn't really cause a performance problem. --~--~-~--~~~---~--~~ You received

Re: Pagination $this->Model->query()

2009-08-17 Thread gjofum
I need to use my own sql code, because if I use your code for find it will do 2 queries and it'll take more time. But thank you for that link, it may be useful for me. On Aug 17, 2:45 am, brian wrote: > Use paginate(). Obviously, that's not the answer you were looking for > but the long and the

Re: Pagination $this->Model->query()

2009-08-16 Thread brian
Use paginate(). Obviously, that's not the answer you were looking for but the long and the short of it is that Cake uses paginate() for pagination. Try this query: $items = $this->Item->find( 'all', array( 'conditions' => array( 'ItemContent

Pagination $this->Model->query()

2009-08-16 Thread gjofum
I'd like to paginate $this->Model->query(). For example I have this in my controller: $this->Item->query("SELECT Item.id, Item.thumb, ItemContent.name, ItemContent.description, Module.code FROM items AS Item INNER JOIN items_content AS ItemContent ON ItemContent.item_id = Item.id INNER JOIN modul