public function getSortValAfterAll($groupingId = null)
    {
        if (!$groupingId === null && $this->grpColumn) {
            throw new SortableException(
                'groupingId may be omitted only when grpColumn is not configured.'
            );
        }

        $query = (new Query())
            ->select($this->srtColumn)
            ->from($this->targetTable)
            ->where([
                'and',
                $this->grpColumn ? ['=', $this->grpColumn, $groupingId] : [],
                $this->skipRowsClause()
            ])
            ->orderBy($this->srtColumn.' DESC')
            ->limit(1);

        $result = $query->one($this->db);

        if ($result) {
            $result = array_values($result);
            $sortVal = $result[0] + $this->sortGap;
        }
        else $sortVal = $this->getIniSortVal();

        return (int)$sortVal;
    }
public function getSortValAfterAll($groupingId = null)
    {
        if (!$groupingId === null && $this->grpColumn) {
            throw new SortableException(
                'groupingId may be omitted only when grpColumn is not configured.'
            );
        }

        $query = (new Query())
            ->select($this->srtColumn)
            ->from($this->targetTable)
            ->where([
                'and',
                $this->grpColumn ? ['=', $this->grpColumn, $groupingId] : [],
                $this->skipRowsClause()
            ])
            ->orderBy($this->srtColumn.' DESC')
            ->limit(1);

        $result = $query->one($this->db);

        if ($result) {
            $result = array_values($result);
            $sortVal = $result[0] + $this->sortGap;
        }
        else $sortVal = $this->getIniSortVal();

        return (int)$sortVal;
    }
public function getSortValAfterAll ( $ groupingId = null ) { if ( ! $ groupingId === null && $ this -> grpColumn ) { throw new SortableException ( 'groupingId may be omitted only when grpColumn is not configured.' ) ; } $ query = ( new Query ( ) ) -> select ( $ this -> srtColumn ) -> from ( $ this -> targetTable ) -> where ( [ 'and' , $ this -> grpColumn ? [ '=' , $ this -> grpColumn , $ groupingId ] : [ ] , $ this -> skipRowsClause ( ) ] ) -> orderBy ( $ this -> srtColumn . ' DESC' ) -> limit ( 1 ) ; $ result = $ query -> one ( $ this -> db ) ; if ( $ result ) { $ result = array_values ( $ result ) ; $ sortVal = $ result [ 0 ] + $ this -> sortGap ; } else $ sortVal = $ this -> getIniSortVal ( ) ; return ( int ) $ sortVal ; }
Derives a sort value for a record to be inserted after all items.

@param null|int $groupingId
@return int
@throws SortableException
Derives a sort value for a record to be inserted after all items .