/** * init * * @return self */ public function init() { // Array $adapter = new \Bluz\Grid\Source\SelectSource(); $select = Table::select(); $adapter->setSource($select); $this->setAdapter($adapter); $this->setDefaultLimit(15); $this->setAllowOrders(['name', 'id', 'status']); $this->setAllowFilters(['status', 'id']); return $this; }
<?php /** * Delete of CRUD * * @category Application * * @author dark * @created 14.05.13 10:51 */ namespace Application; use Bluz\Proxy\Messages; return function ($id) use($view) { /** * @var Bootstrap $this */ if ($row = Test\Table::findRow($id)) { $row->delete(); $this->redirectTo('test', 'index'); Messages::addSuccess("Row was removed"); } else { throw new Exception('Record not found'); } };
<?php /** * Example of DB\Table usage * * @author Anton Shevchuk * @created 18.07.13 13:35 */ namespace Application; use Application\Test; return function () { /** * @var Bootstrap $this */ $table = Test\Table::getInstance(); debug($table->saveTestRow()); debug($table->saveTestRow()); debug($table->updateTestRows()); debug($table->updateTestRows()); debug($table->deleteTestRows()); debug($table->deleteTestRows()); $table = Users\Table::getInstance(); var_dump($table->getColumns()); return false; };