Skip to content

Commit

Permalink
restored FilterManager caching
Browse files Browse the repository at this point in the history
  • Loading branch information
Rico Kaltofen committed Mar 22, 2018
1 parent a54fcff commit 22e2168
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions src/Manager/FilterManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ class FilterManager
*/
protected $session;


/**
* All available filter configurations cache
*
* @var FilterConfig[]
*/
protected $filters;

/**
* Constructor.
*
Expand Down Expand Up @@ -81,6 +89,10 @@ public function getSessionKey(array $filter)
*/
public function findById(int $id)
{
if (isset($this->filters[$id])) {
return $this->filters[$id];
}

/**
* @var FilterConfigModel
*/
Expand All @@ -90,9 +102,9 @@ public function findById(int $id)
return null;
}

$config = $this->getConfig($filter->row());
$this->filters[$id] = $this->getConfig($filter->row());

return $config ?: null;
return isset($this->filters[$id]) ? $this->filters[$id] : null;
}

/**
Expand Down

0 comments on commit 22e2168

Please sign in to comment.