protected function manageRelations()
    {
        foreach ($this->_children as $p => $kids) {
            $parent = $this->_items[$p];

            foreach ($kids as $k) {
                $kid = $this->_items[$k];

                if (!$this->_auth->hasChild($parent, $kid)) {
                    Console::stdout($kid->name . ' added as a child of ' . $parent->name . "\n");
                    $this->_auth->addChild($parent, $kid);
                }
            }

            foreach ($this->_auth->getChildren($p) as $current_kid) {
                if (!in_array($current_kid->name, $kids)) {
                    Console::stdout(Console::ansiFormat('Relation between  ' . $current_kid->name . ' and ' . $parent->name . " was removed!\n", [Console::FG_RED]));
                    $this->_auth->removeChild($parent, $current_kid);
                }
            }
        }
    }
protected function manageRelations()
    {
        foreach ($this->_children as $p => $kids) {
            $parent = $this->_items[$p];

            foreach ($kids as $k) {
                $kid = $this->_items[$k];

                if (!$this->_auth->hasChild($parent, $kid)) {
                    Console::stdout($kid->name . ' added as a child of ' . $parent->name . "\n");
                    $this->_auth->addChild($parent, $kid);
                }
            }

            foreach ($this->_auth->getChildren($p) as $current_kid) {
                if (!in_array($current_kid->name, $kids)) {
                    Console::stdout(Console::ansiFormat('Relation between  ' . $current_kid->name . ' and ' . $parent->name . " was removed!\n", [Console::FG_RED]));
                    $this->_auth->removeChild($parent, $current_kid);
                }
            }
        }
    }
protected function manageRelations ( ) { foreach ( $ this -> _children as $ p => $ kids ) { $ parent = $ this -> _items [ $ p ] ; foreach ( $ kids as $ k ) { $ kid = $ this -> _items [ $ k ] ; if ( ! $ this -> _auth -> hasChild ( $ parent , $ kid ) ) { Console :: stdout ( $ kid -> name . ' added as a child of ' . $ parent -> name . "\n" ) ; $ this -> _auth -> addChild ( $ parent , $ kid ) ; } } foreach ( $ this -> _auth -> getChildren ( $ p ) as $ current_kid ) { if ( ! in_array ( $ current_kid -> name , $ kids ) ) { Console :: stdout ( Console :: ansiFormat ( 'Relation between  ' . $ current_kid -> name . ' and ' . $ parent -> name . " was removed!\n" , [ Console :: FG_RED ] ) ) ; $ this -> _auth -> removeChild ( $ parent , $ current_kid ) ; } } } }
Adding or deleting children if needed
Adding or deleting children if needed