Author: Anton Shevchuk
Inheritance: extends Bluz\Grid\Source\AbstractSource
Example #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;
 }
Example #2
0
 /**
  * init
  *
  * @return self
  */
 public function init()
 {
     // Setup source
     $adapter = new SqlSource();
     $adapter->setSource('SELECT * FROM pages');
     $this->setAdapter($adapter);
     $this->setDefaultLimit(25);
     $this->setAllowOrders(['title', 'id', 'created', 'updated']);
     $this->setAllowFilters(['title', 'alias', 'description', 'content', 'id']);
     return $this;
 }
Example #3
0
 /**
  * Init SqlSource
  * @return self
  */
 public function init()
 {
     // Array
     $adapter = new SqlSource();
     $adapter->setSource('SELECT * FROM test');
     $this->setAdapter($adapter);
     $this->setDefaultLimit(10);
     $this->setAllowOrders(['name', 'id', 'status']);
     $this->setAllowFilters(['status', 'id', 'email']);
     $this->setDefaultOrder('name', Grid::ORDER_DESC);
     return $this;
 }
Example #4
0
 /**
  * SQL Source Exception
  * @expectedException \Bluz\Grid\GridException
  */
 public function testSqlSourceThrowsGridException()
 {
     $adapter = new SqlSource();
     $adapter->setSource(['wrong source type']);
 }