#6452: find('neighbors') doesn't support multiple field order
-----------------------------------------------------------+----------------
    Reporter:  phally                                      |          Type:  
Enhancement
      Status:  new                                         |      Priority:  
Medium     
   Milestone:  1.2.x.x                                     |     Component:  
Model      
     Version:  1.2 Final                                   |      Severity:  
Normal     
    Keywords:  find neighbors scope order multiple fields  |   Php_version:  
n/a        
Cake_version:                                              |  
-----------------------------------------------------------+----------------
 Currently only one field is handled. Like the neighbors of
 {{{
 'field' => 'id',
 'value' => 3
 }}}
 or
 {{{
 'field' => 'created',
 'value' => '2009-05-26 06:20:03'
 }}}
 This means it will sort the results on Model.created ASC and DESC.
 However, in certain situations you would like to order on more than one
 field. For example, on a rating and a uploaddate. Requirements could look
 like: Get next en previous record of a certain Model based on the top
 rated. When the rating is equal those should be ordered on creation date.
 I suggest something similar to:
 {{{
 $this->Movie->find('neighbors', array(
   'scope' => array(
     array(
       'field' => 'rating',
       'order' => 'DESC',
       'value' => 4.85
     ),
     array(
       'field' => 'created',
       'order' => 'DESC',
       'value' => '2009-05-26 06:20:03'
     )
   )
   'conditions' => array(
     'approved' => true,
     'processed' => true
   )
 ));
 }}}

-- 
Ticket URL: <https://trac.cakephp.org/ticket/6452>
CakePHP : The Rapid Development Framework for PHP <https://trac.cakephp.org/>
Cake is a rapid development framework for PHP which uses commonly known design 
patterns like ActiveRecord, Association Data Mapping, Front Controller and MVC. 
Our primary goal is to provide a structured framework that enables PHP users at 
all levels to rapidly develop robust web applications, without any loss to 
flexibility.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"tickets 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/tickets-cakephp?hl=en
-~----------~----~----~----~------~----~------~--~---

  • [CakePHP : The Rapid Dev... CakePHP : The Rapid Development Framework for PHP

Reply via email to