Prevent cacheKey is not set.

This commit is contained in:
David Molineus
2018-08-23 14:48:58 +02:00
parent f60ed1b7be
commit 9e0f11ec18
2 changed files with 7 additions and 3 deletions

View File

@@ -45,7 +45,8 @@
}, },
"require-dev": { "require-dev": {
"phpcq/all-tasks": "^1.2", "phpcq/all-tasks": "^1.2",
"contao/manager-plugin": "^2.1" "contao/manager-plugin": "^2.1",
"phpstan/phpstan": "^0.10.3"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

View File

@@ -206,7 +206,10 @@ class MapProvider
$model = $this->getModel($mapId); $model = $this->getModel($mapId);
} }
if ($model->cache) { $cacheKey = null;
$doCache = $model->cache;
if ($doCache) {
$cacheKey = $this->getCacheKey($mapId, $filter, $elementId, $template, $style); $cacheKey = $this->getCacheKey($mapId, $filter, $elementId, $template, $style);
if ($this->cache->contains($cacheKey)) { if ($this->cache->contains($cacheKey)) {
@@ -219,7 +222,7 @@ class MapProvider
$buffer = $this->doGenerate($model, $filter, $elementId, $template, $style); $buffer = $this->doGenerate($model, $filter, $elementId, $template, $style);
if ($model->cache) { if ($doCache) {
$this->cache->save( $this->cache->save(
$cacheKey, $cacheKey,
[ [