eZ Community » Forums » Developer » Render relation objetcs on template...
expandshrink

Render relation objetcs on template twig

Render relation objetcs on template twig

Monday 30 October 2017 5:19:17 pm

Hi, i am new in ezpublish5 it's possible to explain me how to display the content of relation objects in the parent template.
Here my controller

public function getRelatedArticleAction($id, $show){

$repository=$this->getRepository();$searchService = $repository->getSearchService();$result=array();$query = new LocationQuery(); $criterionAnd = new Criterion\LogicalAnd( array() );$criterionAnd->criteria[] = new Criterion\Visibility( Criterion\Visibility::VISIBLE );$criterionAnd->criteria[] = new Criterion\ContentTypeIdentifier( "article" );$criterionAnd->criteria[]= new Criterion\FieldRelation('article_video',Operator::CONTAINS,array($id));
$query->sortClauses = array(new SortClause\DatePublished( Query::SORT_DESC )); $result=$searchService->findContent( $query )->searchHits;return $this->render("MyWebSiteBundle:render:view_related_article.html.twig", array('result'=>$result,'show'=>$show));

}

 

 

 

Modified on Monday 30 October 2017 5:54:59 pm by Laty Dior

No reply yet!

expandshrink

You must be logged in to post messages in this topic!

36 542 Users on board!

Forums menu

Proudly Developed with from