mirror of
https://github.com/Icinga/icingaweb2-module-businessprocess.git
synced 2025-12-20 23:00:16 -05:00
Node: add helpers related to deletion
This commit is contained in:
parent
7e11ead8a8
commit
32f50c85cf
1 changed files with 27 additions and 0 deletions
|
|
@ -288,11 +288,38 @@ abstract class Node
|
||||||
return count($this->parents) > 0;
|
return count($this->parents) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function hasParentName($name)
|
||||||
|
{
|
||||||
|
foreach ($this->getParents() as $parent) {
|
||||||
|
if ($parent->getName() === $name) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function removeParent($name)
|
||||||
|
{
|
||||||
|
$this->parents = array_filter(
|
||||||
|
$this->parents,
|
||||||
|
function (BpNode $parent) use ($name) {
|
||||||
|
return $parent->getName() !== $name;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
public function getParents()
|
public function getParents()
|
||||||
{
|
{
|
||||||
return $this->parents;
|
return $this->parents;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getPaths()
|
||||||
|
{
|
||||||
|
// TODO! -> for delete etc
|
||||||
|
return $this->parents;
|
||||||
|
}
|
||||||
|
|
||||||
protected function stateToSortState($state)
|
protected function stateToSortState($state)
|
||||||
{
|
{
|
||||||
if (array_key_exists($state, $this->stateToSortStateMap)) {
|
if (array_key_exists($state, $this->stateToSortStateMap)) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue