public function fromArray(array $array, $deep = true)
 {
     if (isset($array['children'])) {
         $children = $array['children'];
         foreach ($children as $child) {
             $new = new csNavigationItem();
             $new->fromArray($child);
             $this->addChild($new);
         }
         unset($array['children']);
     }
     parent::fromArray($array, $deep);
 }
 /**
  * Create a navigation tree from the navigation.yml file
  *
  * @param string $arr 
  * @param string $level 
  * @param string $root 
  * @return void
  * @author Brent Shaffer
  */
 static function getNavigationBranchFromYaml($root, $arr, $commit = false, $level = 1)
 {
     $tree = new Doctrine_Collection('csNavigationItem');
     foreach ($arr as $key => $value) {
         $root->refresh();
         if (is_array($value)) {
             $cleaned = self::cleanItemAttributes($value);
             $item = new csNavigationItem();
             $item->name = $key;
             $item->level = $level;
             $item->fromArray($cleaned['attributes']);
             if ($commit) {
                 $item->save();
                 $item->getNode()->insertAsLastChildOf($root);
             }
             if ($cleaned['children']) {
                 $item = self::getNavigationBranchFromYaml($item, $cleaned['children'], $commit, $level + 1);
             }
         } else {
             $item = new csNavigationItem();
             $item->name = $key;
             $item->route = $value;
             $item->level = $level;
             if ($commit) {
                 $root->getNode()->addChild($item);
             }
         }
         $root->addItem($item);
     }
     return $root;
 }