<?php
namespace App\Controller\Website;
use App\Service\DocumentManagerServices;
use Sulu\Bundle\WebsiteBundle\Controller\DefaultController;
use Sulu\Component\Content\Compat\StructureInterface;
use Symfony\Component\HttpFoundation\RequestStack;
class PartnersController extends DefaultController {
public function __construct(RequestStack $request, DocumentManagerServices $documentManagerService) {
$this->request = $request;
$this->documentManagerService = $documentManagerService;
}
protected function getAttributes($attributes, StructureInterface $structure = null, $preview = true) {
$attributes = parent::getAttributes($attributes, $structure, $preview);
$locale = $this->request->getMainRequest()->getLocale();
$template = "singlePartner";
$nbrItems = $this->documentManagerService->getPageListLength($locale, $template);
$pages = ceil($nbrItems / 6);
$attributes['nbrPages'] = $pages;
return $attributes;
}
}