Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Column with id "tweaks" doesn't exists #1016

Open
GSpecDrum opened this issue Jul 13, 2018 · 0 comments
Open

Column with id "tweaks" doesn't exists #1016

GSpecDrum opened this issue Jul 13, 2018 · 0 comments

Comments

@GSpecDrum
Copy link

GSpecDrum commented Jul 13, 2018

When i apply some tweak, it was saved in session.
After, i try to get applied column filters by call $grid->getFilters(), but in this method code will walk through $grid->sessionData, where are saved grid tweaks.

Then code try to get column by name tweaks, which it get from session and throw this exeption, because entity don't have this column.

Need to add to $requestQueries array in method getFilters() another item with value 'tweaks' to unset them from $session variable.

public function getFilters()
{
if ($this->hash === null) {
throw new \Exception(self::GET_FILTERS_NO_REQUEST_HANDLED_EX_MSG);
}
if ($this->sessionFilters === null) {
$this->sessionFilters = [];
$session = $this->sessionData;
$requestQueries = [
self::REQUEST_QUERY_MASS_ACTION_ALL_KEYS_SELECTED,
self::REQUEST_QUERY_MASS_ACTION,
self::REQUEST_QUERY_EXPORT,
self::REQUEST_QUERY_PAGE,
self::REQUEST_QUERY_LIMIT,
self::REQUEST_QUERY_ORDER,
self::REQUEST_QUERY_TEMPLATE,
self::REQUEST_QUERY_RESET,
MassActionColumn::ID,
];
foreach ($requestQueries as $request_query) {
unset($session[$request_query]);
}
foreach ($session as $columnId => $sessionFilter) {
if (isset($sessionFilter['operator'])) {
$operator = $sessionFilter['operator'];
unset($sessionFilter['operator']);
} else {
$operator = $this->getColumn($columnId)->getDefaultOperator();
}
if (!isset($sessionFilter['to']) && isset($sessionFilter['from'])) {
$sessionFilter = $sessionFilter['from'];
}
$this->sessionFilters[$columnId] = new Filter($operator, $sessionFilter);
}
}
return $this->sessionFilters;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant