/**
  * @param Node $parent
  */
 public function setParent($parent)
 {
     $this->parent = $parent;
     if ($parent !== NULL) {
         $parent->getChildren()->add($this);
     }
 }
 /**
  * Creates a new node tree
  */
 public function createCommand()
 {
     $root = new Node('Root node');
     $firstChild = new Node('First level child');
     $firstChild->setParent($root);
     $firstChildOfFirstChild = new Node('Second level child');
     $firstChildOfFirstChild->setParent($firstChild);
     $secondChildOfFirstChild = new Node('Second level child, 2nd edition');
     $secondChildOfFirstChild->setParent($firstChild);
     $secondChild = new Node('First level child, 2nd edition');
     $secondChild->setParent($root);
     $firstChildOfSecondChild = new Node('Second level child, 3rd edition');
     $firstChildOfSecondChild->setParent($secondChild);
     $secondChildOfSecondChild = new Node('Second level child, 4th edition');
     $secondChildOfSecondChild->setParent($secondChild);
     $thirdChildOfSecondChild = new Node('Second level child, 5th edition');
     $thirdChildOfSecondChild->setParent($secondChild);
     $thirdChild = new Node('First level child, 4rd edition');
     $thirdChild->setParent($root);
     $this->nodeRepository->add($root);
 }