From 85898fa114f1b35a74713cd1a0a475068fa2d3cc Mon Sep 17 00:00:00 2001 From: Priyadi Iman Nurcahyo <1102197+priyadi@users.noreply.github.com> Date: Mon, 15 Jan 2024 06:14:46 +0700 Subject: [PATCH] fix(`CachingMappingFactory`): Skip the cache if in debug mode. --- CHANGELOG.md | 1 + src/Mapping/CachingMappingFactory.php | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index b1e91513..20241366 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -17,6 +17,7 @@ * fix: Remove cache file & regenerate it if it is corrupt. * fix: `NullTransformer` bug. * fix(`CachingMappingFactory`): Cache result in memory. +* fix(`CachingMappingFactory`): Skip the cache if in debug mode. ## 0.5.8 diff --git a/src/Mapping/CachingMappingFactory.php b/src/Mapping/CachingMappingFactory.php index 6fb0a2ec..c7e02ea8 100644 --- a/src/Mapping/CachingMappingFactory.php +++ b/src/Mapping/CachingMappingFactory.php @@ -47,6 +47,10 @@ public function getMapping(): Mapping return $this->mapping; } + if ($this->kernel->isDebug()) { + return $this->mapping = $this->warmUpAndGetMapping(); + } + if (!file_exists($this->getCacheFilePath())) { return $this->mapping = $this->warmUpAndGetMapping(); }