public static function sqlDataProvider($table, $primaryCol, array $cols, array $summaryCols) { $connection = static::connection(); $provider = new SQLDataProvider($connection, $table, $primaryCol, $summaryCols); foreach ($cols as $id => $column) { if (is_string($column)) { $label = $column; $options = []; } else { $label = $column['label']; $options = $column['options']; } $provider->addColumn($id, $id, $label, $options); } $provider->init(); return $provider; }
/** * @param $id * @param $primaryColumn * @return $this */ public function setPrimaryColumnWithId($id, $primaryColumn) { $this->sqlProvider->setPrimaryColumn($id, $primaryColumn); return $this; }