/** * 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; }
/** * 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; }
/** * 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; }
/** * SQL Source Exception * @expectedException \Bluz\Grid\GridException */ public function testSqlSourceThrowsGridException() { $adapter = new SqlSource(); $adapter->setSource(['wrong source type']); }