method getRowBack documentation in bbn\Db\History
function(string $table, string $id, $when, array $columns = [])
{
if (!($when = $this->validDate($when))) {
$this->_report_error("The date $when is incorrect", __CLASS__, __LINE__);
}
elseif (($model = $this->database_obj->modelize($table)) && ($cfg = $this->getTableCfg($table))) {
// Time is after last modification: the current is given
$this->disable();
if ($when >= time()) {
$r = $this->db->rselect(
$table, $columns, [
$cfg['primary'] => $id
]
) ?: null;
}
// Time is before creation: null is given
elseif ($when < $this->getCreationDate($table, $id)) {
$r = null;
}
else {
// No columns = All columns
if (\count($columns) === 0) {
$columns = array_keys($model['fields']);
}
$r = [];
//die(var_dump($columns, $model['fields']));
foreach ($columns as $col){
$tmp = null;
if (isset($model['fields'][$col]['id_option'])) {
if ($tmp = $this->db->rselect(
$this->getHistoryTableName(),
[
$this->getHistoryTableColumnName('val'),
$this->getHistoryTableColumnName('ref')
]
, [
$this->getHistoryTableColumnName('uid') => $id,
$this->getHistoryTableColumnName('col') => $model['fields'][$col]['id_option'],
$this->getHistoryTableColumnName('opr') => 'UPDATE',
[$this->getHistoryTableColumnName('tst'), '>', $when]
]
)
) {
$r[$col] = $tmp[$this->getHistoryTableColumnName('ref')] ?: $tmp[$this->getHistoryTableColumnName('val')];
}
}
if (!$tmp) {
$r[$col] = $this->db->selectOne(
$table, $col, [
$cfg['primary'] => $id
]
);
}
}
}
$this->enable();
return $r;
}
return null;
}
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.
© 2011-2025
BBN Solutions