Return to Snippet

Revision: 31629
at September 28, 2010 23:24 by sveggiani


Updated Code
// Import model inside another
App::Import('Model', 'Example');
$this->Example = new Example;

// add options to paginate the model
$this->paginate['Example'] = array( 'limit' => 5, 'page' => 1 , 'order' => 'Example.name' );
$this->set( 'items', $this->paginate('Example') );




// using containable
$this->Issue->IssuesSerialNumber->Behaviors->attach('Containable');
$this->paginate['IssuesSerialNumber'] = array('limit' => 15, 'page' => 1, 'contain' => array('Issue', 'SerialNumber', 'SerialNumber.Product'), 'order' => 'IssuesSerialNumber.serial_number_id', 'conditions' => array('IssuesSerialNumber.issue_id' => $this->Session->read('Issue.id') ) );

$items = $this->paginate( 'IssuesSerialNumber' );

Revision: 31628
at September 9, 2010 21:34 by sveggiani


Initial Code
// Import model inside another
App::Import('Model', 'Example');
$this->Example = new Example;

// add options to paginate the model
$this->paginate['Example'] = array( 'limit' => 5, 'page' => 1 , 'order' => 'Example.name' );
$this->set( 'items', $this->paginate('Example') );

Initial URL


Initial Description


Initial Title
Cakephp: paginate different model than current and using Containable

Initial Tags
cakephp

Initial Language
PHP