Author: Anton Shevchuk
Inheritance: extends Bluz\Grid\Source\AbstractSource
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;
 }
Example #2
0
 /**
  * Init SelectSource
  * @return self
  */
 public function init()
 {
     // Array
     $adapter = new SelectSource();
     $select = new Select();
     $select->select('*')->from('test', 't');
     $adapter->setSource($select);
     $this->setAdapter($adapter);
     $this->setDefaultLimit(10);
     $this->setAllowOrders(['name', 'id', 'status']);
     $this->setAllowFilters(['status', 'id', 'email']);
     return $this;
 }
Example #3
0
 /**
  * init
  *
  * @return self
  */
 public function init()
 {
     // Create Select
     $select = new Select();
     $select->select('u.*, GROUP_CONCAT( ar.`name` SEPARATOR ", " ) AS rolesList')->from('users', 'u')->leftJoin('u', 'acl_users_roles', 'aur', 'u.`id` = aur.`userId`')->leftJoin('aur', 'acl_roles', 'ar', 'ar.`id` = aur.`roleId`')->groupBy('u.id');
     // Setup adapter
     $adapter = new SelectSource();
     $adapter->setSource($select);
     $this->setAdapter($adapter);
     $this->setDefaultLimit(25);
     $this->setAllowOrders(['login', 'email', 'status', 'id']);
     $this->setAllowFilters(['login', 'email', 'status', 'id', 'roleId']);
     return $this;
 }
Example #4
0
 /**
  * Select Source Exception
  * @expectedException \Bluz\Grid\GridException
  */
 public function testSelectSourceThrowsGridException()
 {
     $adapter = new SelectSource();
     $adapter->setSource('wrong source type');
 }