At the beginning I apologize I didn't use StackOverflow, but the official tag lexikformfilterbundle is not available and due to my reputation (900) I cannot create a new one.
Curenntly I store filters in session like this:
// Filter action
if ($request->get('filter_action') == 'filter') {
// Bind values from the request
$filterForm->handleRequest($request);
if ($filterForm->isValid()) {
// Build the query from the given form object
$filterUpdater->addFilterConditions($filterForm, $queryBuilder);
// Save filter to session
$filterData = $filterForm->getData();
$session->set(sprintf('%sControllerFilter', $this->filterName), $filterData);
$session->set(sprintf('%sControllerFilterPage', $this->filterName), 1);
}
} else {
// Get filter from session
if ($session->has(sprintf('%sControllerFilter', $this->filterName))) {
$filterData = $session->get(sprintf('%sControllerFilter', $this->filterName));
foreach ($filterData as $key => $filter) {
if (is_object($filter)) {
$filterData[$key] = $em->merge($filter);
}
}
$filterForm = $this->createFilterForm($filterData, $this->getSiteFromSession($request));
$filterUpdater->addFilterConditions($filterForm, $queryBuilder);
}
}
But due to EntityManager::merge() deprecations I need to change this solution. Any ideas how to do it? The solution is to skip using EntityFilterType and use ChoiceFilterType but I don't want to, cause it is a nice solution. There are some dirty solutions in mind but as said, they are dirty.
At the beginning I apologize I didn't use StackOverflow, but the official tag lexikformfilterbundle is not available and due to my reputation (900) I cannot create a new one.
Curenntly I store filters in session like this:
But due to
EntityManager::merge()
deprecations I need to change this solution. Any ideas how to do it? The solution is to skip usingEntityFilterType
and useChoiceFilterType
but I don't want to, cause it is a nice solution. There are some dirty solutions in mind but as said, they are dirty.