method remove documentation in bbn\Appui\Option
Deletes a row from the options table, deletes the cache and fix order if needed
Example
X::dump($opt->remove(12));
// (int) 12 Number of options deleted
X::dump($opt->remove(12));
// (null) The option doesn't exist anymore
function($code)
{
if (bbn\Str::isUid($id = $this->fromCode(...\func_get_args()))
&& ($id !== $this->default)
&& ($id !== $this->root)
&& bbn\Str::isUid($id_parent = $this->getIdParent($id))
) {
$num = 0;
if ($items = $this->items($id)) {
foreach ($items as $it){
$num += (int)$this->remove($it);
}
}
$this->deleteCache($id);
$num += (int)$this->db->delete(
$this->class_cfg['table'], [
$this->fields['id'] => $id
]
);
if ($this->isSortable($id_parent)) {
$this->fixOrder($id_parent);
}
return $num;
}
return null;
}
Deletes a row from the options table, deletes the cache and fix order if needed 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