Hello, Thanks problem solved!
It was a problem with the PuchaseOrders hasMany Equipment configuration: 1: The PuchaseOrders hasMany Equipment was configured in the belongsTo part inside the PuchaseOrders model. 2: The foreignKey element in the PuchaseOrder hasMany Equipment was on a wrong field. Once I fixed the everything worked fine. Thanks. 2009/8/17 brian <bally.z...@gmail.com> > Odd. Can you set debug = 2 and post Cake's query? > > You don't have any afterFind() stuff happening? > > 2009/8/17 Jorge Horacio Cué Cantú <jorge....@gmail.com>: > > Hello, > > > > I am having a strange behavior using pagination with Cake 1.2.3.8166 and > > Cake 1.2.4.8284 > > > > I defined the $paginate variable in the controller as: > > > > var $paginate = array( > > 'PurchaseOrder' => array( > > 'limit' => 20, > > 'conditions' => array('PurchaseOrder.status_id' => 14), > > 'contain' => array( > > 'Contract', > > 'Equipment' => array( > > 'fields' => array('id', 'status', 'numero_serie'), > > 'conditions' => array('Equipment.status' => 1) > > ) > > ), > > 'order' => array( > > 'Contract.created' => 'ASC', > > 'PurchaseOrder.id' => 'ASC' > > ) > > ) > > ); > > > > Of course PurchaseOrders belongsTo Contract, and PurchaseOrdes hasMany > > Equipment, the problem is, in index method: > > > > $orders = $this->paginate('PurchaseOrder'); > > > > The problem s that in $orderd array the Equipment is shifted one record > > ahead of the PurchaseOrder that corresponds to, so the Equipment for > record > > [0] is null, then the Equipment in record [1] is the one should be in > record > > [0] and so on, the last Equipment is missing. Because business rules, > every > > PurchaseOrder with status_id 14 has one and only one Equipment with > status = > > 1. > > > > If I check the database with SELECT statements, in there all is OK. > > > > Am I doing something grong?, Please help. > > > > Regards. > > > > > > > > > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~----------~----~----~----~------~----~------~--~---