private function getMaxIdx($parentId = 0, $lessThen = false)
    {
        $query = call_user_func("$this->ownerClassName::find")
            ->select("MAX($this->sortField)");
        if ( $lessThen !== false ) {
            $query->where([ '<', $this->sortField, $lessThen ]);
        }
        if ( $this->parentIdField ) {
            $query->andWhere([ $this->parentIdField => $parentId ]);
        }
        $result = $query->scalar();
        if ( $result === null ) {
            $result = floor($lessThen / 2);
        }
        return (int)$result;
    }
private function getMaxIdx($parentId = 0, $lessThen = false)
    {
        $query = call_user_func("$this->ownerClassName::find")
            ->select("MAX($this->sortField)");
        if ( $lessThen !== false ) {
            $query->where([ '<', $this->sortField, $lessThen ]);
        }
        if ( $this->parentIdField ) {
            $query->andWhere([ $this->parentIdField => $parentId ]);
        }
        $result = $query->scalar();
        if ( $result === null ) {
            $result = floor($lessThen / 2);
        }
        return (int)$result;
    }
private function getMaxIdx ( $ parentId = 0 , $ lessThen = false ) { $ query = call_user_func ( "$this->ownerClassName::find" ) -> select ( "MAX($this->sortField)" ) ; if ( $ lessThen !== false ) { $ query -> where ( [ '<' , $ this -> sortField , $ lessThen ] ) ; } if ( $ this -> parentIdField ) { $ query -> andWhere ( [ $ this -> parentIdField => $ parentId ] ) ; } $ result = $ query -> scalar ( ) ; if ( $ result === null ) { $ result = floor ( $ lessThen / 2 ) ; } return ( int ) $ result ; }
Find max index
@param integer $parentId
@param integer $lessThen
@return integer
Find max index