2016-11-30 10 views
2

私はmagento2でモジュールを開発しています。問題はルーティングにあります。ルータが$ this-> actionFactory-> create( 'Magento \ Framework \ App \ Action \ Forward ');私のモジュール、コントローラー、コードで指定された動作にリダイレクトされません;それは例外を引き起こします。フロントコントローラは100台のルータマッチ反復に達しました。どんな助けも高く評価されます。Magento 2.1.2 Rourterアクション工場が無限ループに入ります

public function match(\Magento\Framework\App\RequestInterface $request) 
    { 

$identifier = trim($request->getPathInfo(), '/'); 

    $condition = new \Magento\Framework\DataObject(['identifier' => $identifier, 'continue' => true]); 
    $this->eventManager->dispatch(
     'news_controller_router_match_before', 
     ['router' => $this, 'condition' => $condition] 
    ); 

    $identifier = $condition->getIdentifier(); 

    if ($condition->getRedirectUrl()) { 

     $this->response->setRedirect($condition->getRedirectUrl()); 
     $request->setDispatched(true); 
     return $this->actionFactory->create('Magento\Framework\App\Action\Redirect'); 
    } 

    if (!$condition->getContinue()) { 
     return null; 
    } 

    /*for main page */ 
    /*check identifier against news-configuration main page idendifier */ 

    //$mainIdentifier = $topic->getMainPageIdentifer(); 
    $mainIdentifier = 'news'; 

    if ($mainIdentifier == $identifier) { 

     $request->setModuleName('news')->setControllerName('index')->setActionName('view'); 
     $request->setAlias(\Magento\Framework\Url::REWRITE_REQUEST_PATH_ALIAS, $identifier); 
      return $this->actionFactory->create('Magento\Framework\App\Action\Forward'); 
    } 



} 
 
1 exception(s): 
Exception #0 (LogicException): Front controller reached 100 router match iterations 

Exception #0 (LogicException): Front controller reached 100 router match iterations 
#0 /opt/lampp/htdocs/Magento-CE-2.1.2_sample/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Framework\App\FrontController->dispatch(Object(Magento\Framework\App\Request\Http)) 
#1 /opt/lampp/htdocs/Magento-CE-2.1.2_sample/vendor/magento/framework/Interception/Chain/Chain.php(70): Magento\Framework\App\FrontController\Interceptor->___callParent('dispatch', Array) 
#2 /opt/lampp/htdocs/Magento-CE-2.1.2_sample/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'requestPreproce...') 
#3 /opt/lampp/htdocs/Magento-CE-2.1.2_sample/vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php(94): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http)) 
#4 /opt/lampp/htdocs/Magento-CE-2.1.2_sample/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http)) 
#5 /opt/lampp/htdocs/Magento-CE-2.1.2_sample/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'install') 
#6 /opt/lampp/htdocs/Magento-CE-2.1.2_sample/vendor/magento/framework/Module/Plugin/DbStatusValidator.php(69): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http)) 
#7 /opt/lampp/htdocs/Magento-CE-2.1.2_sample/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\Framework\Module\Plugin\DbStatusValidator->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http)) 
#8 /opt/lampp/htdocs/Magento-CE-2.1.2_sample/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'front-controlle...') 
#9 /opt/lampp/htdocs/Magento-CE-2.1.2_sample/vendor/magento/module-page-cache/Model/App/FrontController/VarnishPlugin.php(55): Magento\Framework\Interception\Chain\Chain->Magento\Framework\Interception\Chain\{closure}(Object(Magento\Framework\App\Request\Http)) 
#10 /opt/lampp/htdocs/Magento-CE-2.1.2_sample/vendor/magento/framework/Interception/Chain/Chain.php(67): Magento\PageCache\Model\App\FrontController\VarnishPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http)) 
#11 /opt/lampp/htdocs/Magento-CE-2.1.2_sample/vendor/magento/framework/Interception/Interceptor.php(138): Magento\Framework\Interception\Chain\Chain->invokeNext('Magento\\Framewo...', 'dispatch', Object(Magento\Framework\App\FrontController\Interceptor), Array, 'front-controlle...') 
#12 /opt/lampp/htdocs/Magento-CE-2.1.2_sample/vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php(68): Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}(Object(Magento\Framework\App\Request\Http)) 
#13 /opt/lampp/htdocs/Magento-CE-2.1.2_sample/vendor/magento/framework/Interception/Interceptor.php(142): Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch(Object(Magento\Framework\App\FrontController\Interceptor), Object(Closure), Object(Magento\Framework\App\Request\Http)) 
#14 /opt/lampp/htdocs/Magento-CE-2.1.2_sample/var/generation/Magento/Framework/App/FrontController/Interceptor.php(26): Magento\Framework\App\FrontController\Interceptor->___callPlugins('dispatch', Array, Array) 
#15 /opt/lampp/htdocs/Magento-CE-2.1.2_sample/vendor/magento/framework/App/Http.php(135): Magento\Framework\App\FrontController\Interceptor->dispatch(Object(Magento\Framework\App\Request\Http)) 
#16 /opt/lampp/htdocs/Magento-CE-2.1.2_sample/vendor/magento/framework/App/Bootstrap.php(258): Magento\Framework\App\Http->launch() 
#17 /opt/lampp/htdocs/Magento-CE-2.1.2_sample/index.php(39): Magento\Framework\App\Bootstrap->run(Object(Magento\Framework\App\Http)) 
#18 {main} 

+1

最後に私はこの問題を乗り越えました。これは、frontend di.xml 20などでsortorderが原因でした。 – Verdu

+0

ありがとうございます。あなたのソリューションは私を助けます! – Keith

答えて

1

最後に、私は問題を乗り越え、それはSORTORDERによるものであった中などのフロントエンドdi.xml <item name="sortOrder" xsi:type="string">20</item> .Iは60に20を変更し、エラーが消えました。

関連する問題