Created
October 12, 2011 14:35
-
-
Save pedroelsner/1281374 to your computer and use it in GitHub Desktop.
Filter Results forçando parametro no 'conditions' do Paginate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Filter Results | |
$this->FilterResults->addFilters( | |
array( | |
'filter1' => array( | |
'User.name' => array( | |
'operator' => 'LIKE', | |
'beforeValue' => '%', | |
'afterValue' => '%' | |
), | |
'User.active' => array( | |
'value' => '1' | |
) | |
) | |
) | |
); | |
// Paginate | |
$this->paginate['order'] = 'User.name ASC'; | |
$this->paginate['limit'] = 30; | |
$this->paginate['conditions'] = $this->FilterResults->make(); | |
/** | |
* Aqui adicionarmos uma conditions, | |
* que força User.unit_id = 6 | |
*/ | |
$this->paginate['conditions'] += array('User.unit_id' => 6); | |
// Envia para View | |
$this->set('users', $this->paginate('User')); | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment