Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Disabled callbacks in _getMax() & _getMin()

This fixes issues where model/behavior callbacks append into the query
conditions without checking that its an array. Disabling callbacks
should also improve performance a tiny bit.

Refs #GH-1049
  • Loading branch information...
commit ed761320df623c2731cf72e21ad0bc23353a2ff4 1 parent 79c6cbd
@zoghal zoghal authored markstory committed
Showing with 4 additions and 2 deletions.
  1. +4 −2 lib/Cake/Model/Behavior/TreeBehavior.php
View
6 lib/Cake/Model/Behavior/TreeBehavior.php
@@ -941,7 +941,8 @@ protected function _getMax(Model $Model, $scope, $right, $recursive = -1, $creat
list($edge) = array_values($Model->find('first', array(
'conditions' => $scope,
'fields' => $db->calculate($Model, 'max', array($name, $right)),
- 'recursive' => $recursive
+ 'recursive' => $recursive,
+ 'callbacks' => false
)));
return (empty($edge[$right])) ? 0 : $edge[$right];
}
@@ -961,7 +962,8 @@ protected function _getMin(Model $Model, $scope, $left, $recursive = -1) {
list($edge) = array_values($Model->find('first', array(
'conditions' => $scope,
'fields' => $db->calculate($Model, 'min', array($name, $left)),
- 'recursive' => $recursive
+ 'recursive' => $recursive,
+ 'callbacks' => false
)));
return (empty($edge[$left])) ? 0 : $edge[$left];
}
Please sign in to comment.
Something went wrong with that request. Please try again.