public static function createById($gridId, $ignoreError = false)
    {
        if (isset(static::$cache[$gridId])) {
            return static::$cache[$gridId];
        }
        
        $result = self::fetchResult($gridId, $ignoreError);
        
        if ($result) {
            $builder = GridBuilder::create();
            $classes = self::prepareClasses($result);
            $grid    = self::buildGridColumns($builder, $result, $classes);
            $grid->setRowClass($result->rowClass);

            self::buildColumnResets($result, $grid);
        } else {
            $grid = new Grid();
        }

        static::$cache[$gridId] = $grid;

        return static::$cache[$gridId];
    }
public static function createById($gridId, $ignoreError = false)
    {
        if (isset(static::$cache[$gridId])) {
            return static::$cache[$gridId];
        }
        
        $result = self::fetchResult($gridId, $ignoreError);
        
        if ($result) {
            $builder = GridBuilder::create();
            $classes = self::prepareClasses($result);
            $grid    = self::buildGridColumns($builder, $result, $classes);
            $grid->setRowClass($result->rowClass);

            self::buildColumnResets($result, $grid);
        } else {
            $grid = new Grid();
        }

        static::$cache[$gridId] = $grid;

        return static::$cache[$gridId];
    }
public static function createById ( $ gridId , $ ignoreError = false ) { if ( isset ( static :: $ cache [ $ gridId ] ) ) { return static :: $ cache [ $ gridId ] ; } $ result = self :: fetchResult ( $ gridId , $ ignoreError ) ; if ( $ result ) { $ builder = GridBuilder :: create ( ) ; $ classes = self :: prepareClasses ( $ result ) ; $ grid = self :: buildGridColumns ( $ builder , $ result , $ classes ) ; $ grid -> setRowClass ( $ result -> rowClass ) ; self :: buildColumnResets ( $ result , $ grid ) ; } else { $ grid = new Grid ( ) ; } static :: $ cache [ $ gridId ] = $ grid ; return static :: $ cache [ $ gridId ] ; }
Create the grid by id.

@param int  $gridId      The grid id.
@param bool $ignoreError If true no exception is thrown. An empty grid is used instead.

@return Grid
@throws \InvalidArgumentException If grid is not found.
Create the grid by id .