method set documentation in bbn\Appui\Option
Updates an option's row (without changing cfg)
Example
X::dump($opt->set(12, [
'id_parent' => $opt->fromCode('bbn_ide'),
'text' => 'My new option',
'code' => 'new_opt',
'myProperty' => 'my value'
'cfg' => [
'sortable' => true,
'Description' => "I am a cool option"
]
]);
// (int) 1
function($id, array $data)
{
if ($this->check() && $this->_prepare($data)) {
if (isset($data['id'])) {
unset($data['id']);
}
$c =& $this->fields;
// id_parent cannot be edited this way
if ($res = $this->db->update(
$this->class_cfg['table'],
[
$c['text'] => $data[$c['text']],
$c['code'] => !empty($data[$c['code']]) ? $data[$c['code']] : null,
$c['id_alias'] => !empty($data[$c['id_alias']]) ? $data[$c['id_alias']] : null,
$c['value'] => $data[$c['value']]
],
[$c['id'] => $id]
)
) {
$this->deleteCache($id);
return $res;
}
return 0;
}
return null;
}
Updates an option's row (without changing cfg) 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