Never seen this $this->paginate['Bookmark']['contain'] = before, the
['contain'] part I mean
So I just use it like a normal find array?
$this->paginate['Bookmark']['contain'] = array('Job' => array('fields' =>
array(so on and on))),
And
$this->paginate['Bookmark']['conditions'] = array('Bookmark.user_id' =>
$this->Auth->user('id')),
Is there no easy way to paginate from an array? Use a normal find() and pass
the result to paginate?
Thanks for you help.
Dave
-----Original Message-----
From: brian [mailto:[email protected]]
Sent: August-16-09 10:18 PM
To: [email protected]
Subject: Re: Another Paginate Question
Seen what? $paginate? It's a class variable, meaning that it's defined at
the top of the class file and available as $this->paginate (not to be
confused with the method of the same name). See here:
http://book.cakephp.org/view/165/Controller-Setup
On Sun, Aug 16, 2009 at 8:03 PM, Dave Maharaj ::
WidePixels.com<[email protected]> wrote:
>
> Where is this documented in the cookbook?
>
> I have not seen anything like this before now.
>
> Thanks
> Dave
>
> -----Original Message-----
> From: brian [mailto:[email protected]]
> Sent: August-16-09 9:23 PM
> To: [email protected]
> Subject: Re: Another Paginate Question
>
>
> You still haven't included your $paginate array. Normally, you'd set
> that up as a class variable. In the action, you'd add whatever other
> params you require,eg.
>
> $this->paginate['Bookmark']['contain'] = ...
>
> On Sun, Aug 16, 2009 at 2:36 PM, Dave Maharaj ::
> WidePixels.com<[email protected]> wrote:
>>
>> $bookmarks is an array of Bookmark.id's
>>
>> Array
>> (
>> [0] => ad0d27cd3d5
>> [1] => c0c61faf4ec
>> [2] => 5d58e5e97bb
>> )
>>
>> But I cant seem to get it to work when doing it this way.
>>
>> $data = $this->paginate('Bookmark', array('Bookmark.id' =>
>> $bookmarks,'contain' => array(
>> 'Job' => array(
>> 'conditions' =>array(
>> 'Job.status' => 0 ,
>> 'Job.rank <=' => $rank),
>> 'fields' =>array(
>> 'Job.title',
>> 'Job.rank',
>> 'Job.created',
>> SUBSTR('Job.description', 0, 50),
>> 'Job.id',
>> 'Job.quickapply')
>> ))));
>>
>> -----Original Message-----
>> From: brian [mailto:[email protected]]
>> Sent: August-16-09 3:49 PM
>> To: [email protected]
>> Subject: Re: Another Paginate Question
>>
>>
>> Difficult to say without seeing how you're adding the contain block
>> to your $paginate array.
>>
>> On Sun, Aug 16, 2009 at 2:11 PM, Dave Maharaj ::
>> WidePixels.com<[email protected]> wrote:
>>>
>>> I cant seem to get 'contain' in my pagination.
>>>
>>> controller:
>>> function index()
>>> {
>>> $bookmarks =
>>> $this->Bookmark->__getBookmarks($this->Auth->user('id'));
>>> $data = $this->paginate('Bookmark', array('Bookmark.id' =>
>>> $bookmarks));
>>> $this->set('bookmarks', $data);
>>> }
>>>
>>> I need to add this:
>>>
>>> 'contain' => array(
>>> 'Job' => array(
>>> 'conditions' =>array(
>>> 'Job.status' => 0 ,
>>> 'Job.rank <=' => $rank),
>>> 'fields' =>array(
>>> 'Job.title',
>>> 'Job.rank',
>>> 'Job.created',
>>> SUBSTR('Job.description', 0, 50),
>>> 'Job.id',
>>> 'Job.quickapply')
>>> ))
>>>
>>> What ever I try I end up with
>>> SQL Error: 1054: Unknown column 'contain' in 'where clause'
>>>
>>> Ideas where I am going wrong?
>>>
>>> Thanks,
>>>
>>> Dave
>>>
>>>
>>> >
>>>
>>
>>
>>
>> >
>>
>
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CakePHP" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/cake-php?hl=en
-~----------~----~----~----~------~----~------~--~---