fix formula cache issue
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
@@ -39,11 +39,14 @@ class Evaluator
|
||||
|
||||
private $parser;
|
||||
|
||||
private $attributeFetcher;
|
||||
|
||||
private $parsedHash;
|
||||
|
||||
public function __construct($container = null, array $functionClassNameMap = array(), array $parsedHash = array())
|
||||
{
|
||||
$this->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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
/************************************************************************
|
||||
* This file is part of EspoCRM.
|
||||
*
|
||||
@@ -38,10 +38,10 @@ class FunctionFactory
|
||||
|
||||
private $classNameMap;
|
||||
|
||||
public function __construct($container, $classNameMap = null)
|
||||
public function __construct($container, AttributeFetcher $attributeFetcher, $classNameMap = null)
|
||||
{
|
||||
$this->container = $container;
|
||||
$this->attributeFetcher = new AttributeFetcher();
|
||||
$this->attributeFetcher = $attributeFetcher;
|
||||
$this->classNameMap = $classNameMap;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user