method keys documentation in bbn\Appui\Database
Returns a list of keys for the giuven table.
function(string $table, string $db = '')
{
$res = [];
if (!bbn\Str::isUid($table) && bbn\Str::isUid($db)) {
$table = $this->tableId($table, $db);
}
if (bbn\Str::isUid($table)
&& ($id_parent = $this->o->fromCode('keys', $table))
&& ($tree = $this->o->fullTree($id_parent))
&& $tree['items']
) {
$t =& $this;
$res = array_map(
function ($a) use ($t) {
$key = [
'name' => $a['code'],
'unique' => $a['unique'],
'columns' => [],
'ref_column' => $a['id_alias'] ? $a['alias']['code'] : null,
'ref_table' => $a['id_alias'] &&
($id_table = $t->o->getIdParent($a['alias']['id_parent'])) ? $t->o->code($id_table) : null,
'ref_db' => !empty($id_table) &&
($id_db = $t->o->getIdParent($t->o->getIdParent($id_table))) ? $t->o->code($id_db) : null
];
foreach ($a['items'] as $col){
$key['columns'][] = $col['code'];
}
return $key;
},
$tree['items']
);
}
return $res;
}
Returns a list of keys for the giuven table. 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