diff --git a/composer.json b/composer.json index aa9638a..775cb90 100644 --- a/composer.json +++ b/composer.json @@ -45,7 +45,8 @@ }, "require-dev": { "phpcq/all-tasks": "^1.2", - "contao/manager-plugin": "^2.1" + "contao/manager-plugin": "^2.1", + "phpstan/phpstan": "^0.10.3" }, "autoload": { "psr-4": { diff --git a/src/MapProvider.php b/src/MapProvider.php index d630dcf..adf6504 100644 --- a/src/MapProvider.php +++ b/src/MapProvider.php @@ -206,7 +206,10 @@ class MapProvider $model = $this->getModel($mapId); } - if ($model->cache) { + $cacheKey = null; + $doCache = $model->cache; + + if ($doCache) { $cacheKey = $this->getCacheKey($mapId, $filter, $elementId, $template, $style); if ($this->cache->contains($cacheKey)) { @@ -219,7 +222,7 @@ class MapProvider $buffer = $this->doGenerate($model, $filter, $elementId, $template, $style); - if ($model->cache) { + if ($doCache) { $this->cache->save( $cacheKey, [