onFetch - landrisek/impala GitHub Wiki
IBuilder::fetch You can modify final data including styles with callback. In callback is passed IBuilder and row data in array format. No other data is allowed. It is considered for best practice to type callback parameters for future DI implementation in Impala IRow Impala\IRow overload all fetched columns as public properties, so it can be uses as ActiveRow. E.g., call $this->row->id would return id value of given row. To detect conflict of this public overloaded properties and private overload properties, there is InvalidStateException called also by automatic tests if conflict occured. All private properties of IRowBuilder begin on "row" (rowData, etc.) to avoid conflict. As long as you keep code standard to not using big letters in your name columns, you should be fine. However it means you should not have columns in your tables with same name as any private IRow stated here. It is price for starightforward calling of columns from IRow Mock filter by NULL in select statement In case you need independent filter process in Impala\IFetch: $this->grid->table('table')->select('alias'=>null) Mock data $fetch = new MyFetch implements Impala\IFetch; $this->builder->fetch($fetch); IFetch::fetch public class MyFetch implements Impala\IFetch { public function fetch(IBuilder $builder): array { $offset = ($builder->getPost('offset') - 1) * $this->pagination; $now = strtotime('-' . $offset . ' month'); $date = strtotime('-' . $this->pagination . ' month', $now); $months = []; while($date < $now) { $months[] = ['date' => date('M Y', $date)]; $date = strtotime('+1 month', $date) ; } return $months } public function sum(IBuilder $builder): int { $date = strtotime(self::DATE); $now = strtotime('now'); $sum = 1; while($date < $now) { $sum++; $date = strtotime('+1 month', $date); } } }