2017-09-06 2 views

Répondre

0

Vous pouvez envoyer vos données de formulaire à une action qui ira chercher un résultat dans votre référentiel ou vous pouvez stocker l'argument en tant que session.

exemple sous forme liquide:

<f:form action="search" controller=""> 
    <label for="city-select">Select the city to search for</label> 
    <f:form.select name="searchString" id="city-select" options="cities" optionValueField="title" optionLabelField="title" /> 
</f:form> 

Controller Exemple de classe:

/** 
* The action search. 
* 
* @param string $searchString 
*/ 
public function searchAction($searchString) 
{ 
    // Do a search by a repository function... 
    $result = $this->yourRepository->findbySearchSDtring($searchString); 
    // code ... 

    // Or save it to session and do other stuff. 
    if ($GLOBALS['TSFE']->loginUser) { 
     // if the user is logged in, store it in the current logged in fe_user session. 
     $myData = $GLOBALS['TSFE']->fe_user->setKey('user', 'mySessionData', $searchString); 
    } else { 
     // Otherwise store it in the user session. 
     $myData = $GLOBALS['TSFE']->fe_user->setKey('ses', 'mySessionData', $searchString); 
    } 
    // code ... 
} 
+0

Merci beaucoup, cela fonctionne –

+0

vous êtes les bienvenus! – alphajunge