Skip to content

Commit

Permalink
There was no use for _getMin, so removing it
Browse files Browse the repository at this point in the history
  • Loading branch information
lorenzo committed Apr 5, 2014
1 parent 159eeee commit cb0752b
Showing 1 changed file with 2 additions and 22 deletions.
24 changes: 2 additions & 22 deletions src/Model/Behavior/TreeBehavior.php
Expand Up @@ -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})) {
Expand Down

0 comments on commit cb0752b

Please sign in to comment.