method getColumnHistory documentation in bbn\Appui\History

function(string $table, string $id, string $column) { if ( self::check($table) && ($primary = self::$db->getPrimary($table)) && ($modelize = self::getTableCfg($table)) ){ if ( \bbn\Str::isUid($column) ){ $column = \bbn\X::find($modelize['fields'], ['id_option' => strtolower($column)]); } $current = self::$db->selectOne($table, $column, [ $primary[0] => $id ]); $val = $modelize['fields'][$column] === 'binary' ? 'ref' : 'val'; $hist = self::getHistory($table, $id, $column); $r = []; if ( $crea = self::getCreation($table, $id) ){ if ( !empty($hist['upd']) ){ $hist['upd'] = array_reverse($hist['upd']); foreach ( $hist['upd'] as $i => $h ){ if ( $i === 0 ){ $r[] = [ 'date' => $crea['date'], $val => $h[$val], 'user' => $crea['user'] ]; } else{ $r[] = [ 'date' => $hist['upd'][$i-1]['date'], $val => $h[$val], 'user' => $hist['upd'][$i-1]['user'] ]; } } $r[] = [ 'date' => $hist['upd'][$i]['date'], $val => $current, 'user' => $hist['upd'][$i]['user'] ]; } else if (!empty($hist['ins']) ){ $r[0] = [ 'date' => $hist['ins'][0]['date'], $val => $current, 'user' => $hist['ins'][0]['user'] ]; } } return $r; } }

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.