Bluz\Grid\Source\SqlSource::setSource PHP Method

setSource() public method

Set SQL source
public setSource ( string $source ) : self
$source string
return self
    public function setSource($source)
    {
        if (!is_string($source)) {
            throw new Grid\GridException("Source of `SqlSource` should be string with SQL query");
        }
        $this->source = $source;
        return $this;
    }

Usage Example

Beispiel #1
0
 /**
  * init
  *
  * @return self
  */
 public function init()
 {
     // Setup source
     $adapter = new SqlSource();
     $adapter->setSource('SELECT * FROM musician');
     $this->setAdapter($adapter);
     $this->setDefaultLimit(25);
     $this->setAllowOrders(['title', 'id', 'created', 'updated']);
     $this->setAllowFilters(['id', 'nickname', 'image', 'music_type', 'group', 'concert_date']);
     return $this;
 }
All Usage Examples Of Bluz\Grid\Source\SqlSource::setSource