スケルトン アプリケーション (ZF2) でメニューを作成したいと考えています。別のモジュールを作成しましたNavigation
。ナビゲーションコントローラーでコードを書きました:
namespace Navigation\Controller;
use Zend\Mvc\Controller\AbstractActionController;
use Zend\View\Model\ViewModel;
use Zend\Navigation\Navigation;
class NavigationController extends AbstractActionController
{
public function indexAction()
{
$container = new \Zend\Navigation\Navigation(array(
array(
'label' => 'Album',
'controller' => 'album',
'action' => 'index',
'route' => 'album',
)
));
$navigation = new \Zend\View\Helper\Navigation\Menu();
$navigation->renderMenu($container);
return new ViewModel(array('navigation'=>$navigation));
}}
そして間違いを犯してください:
Zend\Navigation\Page\Mvc::getHref cannot execute as no Zend\Mvc\Router\RouteStackInterface instance is composed
ファイル: \vendor\zendframework\zendframework\library\Zend\Navigation\Page\Mvc.php:186
どのように解決しますか?