diff --git a/application/Espo/Core/Formula/Evaluator.php b/application/Espo/Core/Formula/Evaluator.php index 327edd7d62..02d9a4ec5b 100644 --- a/application/Espo/Core/Formula/Evaluator.php +++ b/application/Espo/Core/Formula/Evaluator.php @@ -1,4 +1,4 @@ -functionFactory = new \Espo\Core\Formula\FunctionFactory($container, $functionClassNameMap); + $this->attributeFetcher = new AttributeFetcher(); + $this->functionFactory = new \Espo\Core\Formula\FunctionFactory($container, $this->attributeFetcher, $functionClassNameMap); $this->formula = new \Espo\Core\Formula\Formula($this->functionFactory); $this->parser = new \Espo\Core\Formula\Parser(); $this->parsedHash = array(); @@ -61,6 +64,11 @@ class Evaluator if (!$item || !($item instanceof \StdClass)) { throw new Error(); } - return $this->formula->process($item, $entity, $variables); + + $result = $this->formula->process($item, $entity, $variables); + + $this->attributeFetcher->resetRuntimeCache(); + + return $result; } -} \ No newline at end of file +} diff --git a/application/Espo/Core/Formula/FunctionFactory.php b/application/Espo/Core/Formula/FunctionFactory.php index 4fc815a72b..244ed66b0c 100644 --- a/application/Espo/Core/Formula/FunctionFactory.php +++ b/application/Espo/Core/Formula/FunctionFactory.php @@ -1,4 +1,4 @@ -container = $container; - $this->attributeFetcher = new AttributeFetcher(); + $this->attributeFetcher = $attributeFetcher; $this->classNameMap = $classNameMap; }