Created
March 6, 2014 22:27
-
-
Save andrebian/9401117 to your computer and use it in GitHub Desktop.
This file contains 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 | |
//Definindo a ordenação da paginação por dois itens | |
/** | |
* | |
* @param array $queryData | |
* @return array | |
*/ | |
public function beforeFind( $queryData ) | |
{ | |
parent::beforeFind($queryData); | |
if ( !empty($queryData['sort']) && $queryData['sort'] == 'primeiro_campo' ) { | |
$segundoCampo = array($this->alias . '.segundo_campo' => '[ASC|DESC]'); | |
if (is_array($queryData['order'][0])) { | |
$queryData['order'][0] = $queryData['order'][0] + $segundoCampo; | |
} else { | |
$queryData['order'][0] = $segundoCampo; | |
} | |
} | |
return $queryData; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment