I have a query that outputs a paginated list of records based on a
staff member's region (comprised of states):
-----------------------------------------------------------------------------------
$this->paginate =
array('fields'=>array('Application.id'),'conditions'=>'Application.statuslist_id
= Statuslist.id AND Application.state IN
(SELECT S.shortname FROM states S
INNER JOIN regions_states RS ON RS.state_id = S.id
INNER JOIN regions R ON R.id = RS.region_id
AND R.region IN ( SELECT R.region from staffs_regions SR, regions R
where R.id = SR.region_id AND SR.staff_id='.$this->Session-
>read("id").')) ' . $otherstatecondition . ' OR Application.staff_id =
'.$this->Session->read("id"),'order'=>'Application.id desc','limit' =>
$limit, 'page' => 1,'recursive'=>'0','order'=>'Application.id desc');
$this->set('viewallinfo', $this->paginate('Application'));
-----------------------------------------------------------------------------------
I need to use this query on each individual record to display a next
and previous button, but I'm not sure I have the structure correct for
find neighbors (http://book.cakephp.org/view/811/find-neighbors).
-----------------------------------------------------------------------------------
$neighbors = $this->Application->find('neighbors',
array('fields'=>'Application.id','conditions'=>'Application.statuslist_id
= Statuslist.id AND Application.state IN
(SELECT S.shortname FROM states S
INNER JOIN regions_states RS ON RS.state_id = S.id
INNER JOIN regions R ON R.id = RS.region_id
AND R.region IN ( SELECT R.region from staffs_regions SR, regions R
where R.id = SR.region_id AND SR.staff_id='.$this->Session-
>read("id").')) ' . $otherstatecondition . ' OR Application.staff_id =
'.$this->Session->read("id"),'value' => $id));
$this->set('neighbors', $neighbors);
-----------------------------------------------------------------------------------
What should I do or what params are incorrect? The $this->paginate
query works as expected. I'm just having trouble getting it to work
with find neighbors. Thanks for the help.
Check out the new CakePHP Questions site http://cakeqs.org and help others with
their CakePHP related questions.
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