fix to paginate sort order for self associated models

git-svn-id: https://svn.cakephp.org/repo/branches/1.2.x.x@7278 3807eeeb-6ff5-0310-8944-8be069107fe0
This commit is contained in:
gwoo 2008-06-27 03:12:45 +00:00
parent 1576a83505
commit b8714ede74

View file

@ -683,7 +683,7 @@ class Controller extends Object {
* @param string $action Action name to render * @param string $action Action name to render
* @param string $layout Layout to use * @param string $layout Layout to use
* @param string $file File to use for rendering * @param string $file File to use for rendering
* @return boolean Success * @return string Full output string of view contents
* @access public * @access public
*/ */
function render($action = null, $layout = null, $file = null) { function render($action = null, $layout = null, $file = null) {
@ -923,10 +923,12 @@ class Controller extends Object {
if (strpos($key, '.') !== false) { if (strpos($key, '.') !== false) {
$field = array_pop(explode('.', $key)); $field = array_pop(explode('.', $key));
} }
if ($object->hasField($field)) {
$options['order'][$object->alias . '.' . $field] = $options['order'][$key]; $value = $options['order'][$key];
} else {
unset($options['order'][$key]); unset($options['order'][$key]);
if ($object->hasField($field)) {
$options['order'][$object->alias . '.' . $field] = $value;
} }
} }