protected function prepareTwig() { $groups = Group::getGroups($this->getMe()->getId()); Service::getTemplateEngine()->addGlobal("groups", $groups); $creator = new MessageSearchFormCreator(); $searchForm = $creator->create(); Service::getTemplateEngine()->addGlobal("searchForm", $searchForm->createView()); }
protected function prepareTwig() { $currentPage = $this->getRequest()->query->get('page', 1); $query = $this->getQueryBuilder('Conversation')->forPlayer($this->getMe())->sortBy('last_activity')->reverse()->limit(5)->fromPage($currentPage); $creator = new MessageSearchFormCreator(); $searchForm = $creator->create(); $twig = $this->container->get('twig'); $twig->addGlobal("conversations", $query->getModels()); $twig->addGlobal("currentPage", $currentPage); $twig->addGlobal("totalPages", $query->countPages()); $twig->addGlobal("searchForm", $searchForm->createView()); return $twig; }