Skip to content

Instantly share code, notes, and snippets.

@MarioBlazek
Last active April 29, 2019 13:53
Show Gist options
  • Save MarioBlazek/22a8a285336f17e09febb42f52dad54b to your computer and use it in GitHub Desktop.
Save MarioBlazek/22a8a285336f17e09febb42f52dad54b to your computer and use it in GitHub Desktop.
<?php
namespace AppBundle\Controller;
use AppBundle\Queries\LatestRelatedRecipes;
use Netgen\Bundle\EzPlatformSiteApiBundle\Controller\Controller;
use Netgen\Bundle\EzPlatformSiteApiBundle\View\ContentView;
class FullViewController extends Controller
{
public function viewRecipe(ContentView $view)
{
$queryType = $this->get('ezpublish.query_type.registry')
->getQueryType(LatestRelatedRecipes::getName());
$query = $queryType->getQuery([
'recipe_content_id' => $view->getSiteContent()->id,
'limit' => 4,
]);
$recipies = $this->getSite()
->getFilterService()
->filterLocations($query);
$view->addParameters([
'recipies' => $this->extractValueObjects($recipies),
]);
return $view;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment