diff --git a/src/Model/Behavior/TreeBehavior.php b/src/Model/Behavior/TreeBehavior.php index 43f1fb2c453..b4398b29516 100644 --- a/src/Model/Behavior/TreeBehavior.php +++ b/src/Model/Behavior/TreeBehavior.php @@ -560,32 +560,12 @@ protected function _recoverTree($counter = 0, $parentId = null) { * @return integer */ protected function _getMax() { - return $this->_getMaxOrMin('max'); - } - -/** - * Returns the minimum index value in the table. - * - * @return integer - */ - protected function _getMin() { - return $this->_getMaxOrMin('min'); - } - -/** - * Get the maximum|minimum index value in the table. - * - * @param string $maxOrMin Either 'max' or 'min' - * @return integer - */ - protected function _getMaxOrMin($maxOrMin = 'max') { $config = $this->config(); - $field = $maxOrMin === 'max' ? $config['right'] : $config['left']; - $direction = $maxOrMin === 'max' ? 'DESC' : 'ASC'; + $field = $config['right']; $edge = $this->_scope($this->_table->find()) ->select([$field]) - ->order([$field => $direction]) + ->order([$field => 'DESC']) ->first(); if (empty($edge->{$field})) {