Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
* @Route("/school/search/", name="school_search")
* @Template("FlintSAKGFKitchenGardenProfileBundle:Default:school-search.html.twig")
* @param \Symfony\Component\HttpFoundation\Request $request
* @return array
public function searchAction(Request $request)
$schoolSearch = $this->getSchoolSearch($request);
$form = $this->createForm(new Form\SchoolSearchType(), $schoolSearch);
$returnArray = array('schoolSearch' => $schoolSearch);
if ($request->getMethod() == 'POST') {
if ($schoolSearch->isValid()){
$schoolSearchService = $this->get('flint_sakgf_kitchen_garden_profile.school_search');
$query = $schoolSearchService->getSearchQuery($schoolSearch);
$pager = Pager::get($query, $request, self::SEARCH_PER_PAGE);
$returnArray['results'] = $pager;
$request->getSession()->setFlash('schoolSearch', $schoolSearch);
$returnArray['form'] = $form->createView();
// return amalgamated array.
return $returnArray;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.