protected function _getHighestOrder(array $scope = [])
    {
        $orderField = $this->_config['order'];

        // Find the last record in the set
        $last = $this->_table->find()
            ->select([$orderField])
            ->where($scope)
            ->order([$orderField => 'DESC'])
            ->limit(1)
            ->enableHydration(false)
            ->first();

        // If there is a last record (i.e. any) in the set, return the it's order
        if ($last) {
            return $last[$orderField];
        }

        // If there isn't any records in the set, return the start number minus 1
        return (int)$this->_config['start'] - 1;
    }
protected function _getHighestOrder(array $scope = [])
    {
        $orderField = $this->_config['order'];

        // Find the last record in the set
        $last = $this->_table->find()
            ->select([$orderField])
            ->where($scope)
            ->order([$orderField => 'DESC'])
            ->limit(1)
            ->enableHydration(false)
            ->first();

        // If there is a last record (i.e. any) in the set, return the it's order
        if ($last) {
            return $last[$orderField];
        }

        // If there isn't any records in the set, return the start number minus 1
        return (int)$this->_config['start'] - 1;
    }
protected function _getHighestOrder ( array $ scope = [ ] ) { $ orderField = $ this -> _config [ 'order' ] ; // Find the last record in the set $ last = $ this -> _table -> find ( ) -> select ( [ $ orderField ] ) -> where ( $ scope ) -> order ( [ $ orderField => 'DESC' ] ) -> limit ( 1 ) -> enableHydration ( false ) -> first ( ) ; // If there is a last record (i.e. any) in the set, return the it's order if ( $ last ) { return $ last [ $ orderField ] ; } // If there isn't any records in the set, return the start number minus 1 return ( int ) $ this -> _config [ 'start' ] - 1 ; }
Returns the current highest order of all records in the set. When a new
record is added to the set, it is added at the current highest order, plus
one.

@param array $scope Array with scope field => scope values, used for conditions.

@return int Value of order field of last record in set
Returns the current highest order of all records in the set . When a new record is added to the set it is added at the current highest order plus one .