method isParent documentation in bbn\Appui\Option
Return true if row with ID $id_parent is parent at any level of row with ID $id
Example
X::dump($opt->isParent(42, 12));
// (bool) true
X::dump($opt->isParent(42, 13));
// (bool) false
function($id, $id_parent)
{
// Preventing infinite loop
$done = [$id];
if (bbn\Str::isUid($id) && bbn\Str::isUid($id_parent)) {
while ($id = $this->getIdParent($id)){
if ($id === $id_parent) {
return true;
}
if (\in_array($id, $done, true)) {
break;
}
$done[] = $id;
}
}
return false;
}
Return true if row with ID $id_parent is parent at any level of row with ID $id 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