From ed761320df623c2731cf72e21ad0bc23353a2ff4 Mon Sep 17 00:00:00 2001 From: Saleh Souzanchi Date: Tue, 25 Dec 2012 04:30:07 +0330 Subject: [PATCH] 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 --- lib/Cake/Model/Behavior/TreeBehavior.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Cake/Model/Behavior/TreeBehavior.php b/lib/Cake/Model/Behavior/TreeBehavior.php index 9ed88ca8d..4125df2f8 100644 --- a/lib/Cake/Model/Behavior/TreeBehavior.php +++ b/lib/Cake/Model/Behavior/TreeBehavior.php @@ -941,7 +941,8 @@ class TreeBehavior extends ModelBehavior { 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 @@ class TreeBehavior extends ModelBehavior { 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]; }