Bluz\Grid\Source\SelectSource::setSource PHP Метод

setSource() публичный Метод

Set Select source
public setSource ( Select $source ) : self
$source Bluz\Db\Query\Select
Результат self
    public function setSource($source)
    {
        if (!$source instanceof Db\Query\Select) {
            throw new Grid\GridException("Source of `SelectSource` should be `Db\\Query\\Select` object");
        }
        $this->source = $source;
        return $this;
    }

Usage Example

Пример #1
0
 /**
  * init
  *
  * @return self
  */
 public function init()
 {
     $table = Table::getInstance();
     $adapter = new SelectSource();
     $adapter->setSource($table->advancedSelect());
     $this->setAdapter($adapter);
     $this->setDefaultLimit(25);
     $this->setAllowOrders(['title', 'id', 'cost', 'categoryId']);
     $this->setAllowFilters(['title', 'description', 'categoryId', 'id']);
     return $this;
 }
All Usage Examples Of Bluz\Grid\Source\SelectSource::setSource