2017-12-09 16 views
0

コントローラファイルと小枝テンプレートがありますが、通信が妨げられています。 例外は次のとおりです。Symfony Exception、コントローラーと小枝付きのDBクエリ

テンプレートのレンダリング中に例外がスローされました(「イテレータを生成中のエラー」)。

コントローラファイルで何かが間違っていたり、設定に問題があります。

namespace AppBundle\Controller; 
use Pimcore\Controller\Configuration\ResponseHeader; 
use Pimcore\Model\Asset; 
use Symfony\Component\HttpFoundation\Request; 
use Symfony\Component\HttpFoundation\Response; 
use Pimcore\Model\DataObject\ArticleCategory; 
use Zend\Paginator\Paginator; 


class ContentController extends FrontendController 
{ 
    public function testroot1Action(Request $request) 
    { 
     $articleCategory = new ArticleCategory\Listing(); 
     $articleCategory->setOrderKey('date'); 
     $articleCategory->setOrder('DESC'); 

     $paginator = new Paginator($articleCategory); 
     $paginator->setCurrentPageNumber($request->get('page')); 
     $paginator->setItemCountPerPage(5); 
     var_dump($paginator); 

     $this->view->content = $paginator; 

    } 
} 

小枝テンプレート:

私のオブジェクトは、 "ArticleCategory" コントローラです。 Exceptionはmy forループから来ます。 「コンテンツ」dosent仕事の反復:

{% extends 'layout.html.twig' %} 
{% block content %} 


    {{ dump(content)}} 

    {% for contents in content %} 

     {{ dump(contents)}}   

    {% endfor %} 

{% block content %} 

が気にいらやるべきことか気にいら間違っていますか?

答えて

1

それは次のようになります。それをイマイチ

{% extends 'layout.html.twig' %} 
{% block content %}   

    {% for content in contents %}  

     // here you have access to a singular content object 

    {% endfor %} 

{% block content %} 
0

ああなし! 私の上場は空いているようです!

$articleCategory = new ArticleCategory\Listing(); 

フム、私はそれが後でよりThxをテストします

+0

は、それが私のクラスでattributた解決しました! –

関連する問題