Dynamic Menu with relations from Database

Hello :),

I want a simple multilevel menu with values from a database.

I use the bootstrap-widget extension, so I subclassed from EBootstrapSidebar (which is inherited from CMenu).

The init function:


public function init()

  {

   

  

    $navHeader = CmsNavigationHeader::model()->with('cmsNavigationitems')->findAll();

    

    foreach ($navHeader as $key)

    {

     foreach($key->cmsNavigationitems as $newKey)

      {

         $this->items[]= 

         array('label' => $key->content, 'items'=>array(array('label' => $newKey->content, 'url' => '#')));

      }

    }

    parent::init();

}

    

But now I have mutliple Headers in my menu. How can I ensure that the headers are only passed one time but dont lose their "childs"?