method getHistory documentation in bbn\Db\History

function(string $table, string $id, string $col = '') { if ($this->check() && ($modelize = $this->getTableCfg($table))) { $pat = [ 'ins' => 'INSERT', 'upd' => 'UPDATE', 'res' => 'RESTORE', 'del' => 'DELETE' ]; $r = []; $fields = [ 'date' => $this->getHistoryTableColumnName('tst'), 'user' => $this->getHistoryTableColumnName('usr'), $this->getHistoryTableColumnName('col') ]; $where = [ $this->getHistoryTableColumnName('uid') => $id ]; if (!empty($col)) { if (!Str::isUid($col)) { $fields[] = $modelize['fields'][$col]['type'] === 'binary' ? $this->getHistoryTableColumnName('ref') : $this->getHistoryTableColumnName('val'); $col = $this->database_obj->columnId($col, $table); } else { $idx = X::find($modelize['fields'], ['id_option' => strtolower($col)]); if (null === $idx) { throw new \Error(X::_("Impossible to find the option $col")); } $fields[] = $modelize['fields'][$idx]['type'] === 'binary' ? $this->getHistoryTableColumnName('ref') : $this->getHistoryTableColumnName('val'); } $where[$this->getHistoryTableColumnName('col')] = $col; } else { $fields[] = $this->getHistoryTableColumnName('val'); $fields[] = $this->getHistoryTableColumnName('ref'); } foreach ($pat as $k => $p){ $where[$this->getHistoryTableColumnName('opr')] = $p; if ($q = $this->db->rselectAll( [ 'table' => $this->getHistoryTableName(), 'fields' => $fields, 'where' => [ 'conditions' => $where ], 'order' => [[ 'field' => $this->getHistoryTableColumnName('tst'), 'dir' => 'desc' ]] ] ) ) { $r[$k] = $q; } } return $r; } return []; }

BBN is a suite of PHP and JS libraries and VueJS components - all open-source! bbn.io, build applications, the quick way

This website uses cookies to ensure you get the best experience on our website.