method options documentation in bbn\Appui\Option
Returns an array of options in the form id => text
Example
X::dump($opt->options(12));
/*
[
21 => "My option 21",
22 => "My option 22",
25 => "My option 25",
27 => "My option 27"
]
function($code = NULL)
{
if (bbn\Str::isUid($id = $this->fromCode(\func_get_args()))) {
//var_dump("MY ID: $id");
if ($r = $this->cacheGet($id, __FUNCTION__)) {
return $r;
}
$cf =& $this->fields;
$res = $this->db->selectAllByKeys([
'tables' => [$this->class_cfg['table']],
'fields' => [
'id' => $this->class_cfg['table'].'.'.$cf['id'],
'text' => 'IFNULL('.
$this->db->cfn($cf['text'], $this->class_cfg['table'], true).', '.
$this->db->cfn($cf['text'], 'alias', true).
')'
],
'join' => [
[
'table' => $this->class_cfg['table'],
'alias' => 'alias',
'type' => 'LEFT',
'on' => [
[
'field' => $this->class_cfg['table'].'.'.$cf['id_alias'],
'exp' => 'alias.'.$cf['id']
]
]
]
],
'where' => [$this->class_cfg['table'].'.'.$cf['id_parent'] => $id],
'order' => ['text' => 'ASC']
]);
$this->cacheSet($id, __FUNCTION__, $res);
return $res;
}
return null;
}
Returns an array of options in the form id => text 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-2023
BBN Solutions