Refactor form property logic rule to load condition mapping from external JSON file (#698)
* Refactor form property logic rule to load condition mapping from external JSON file * fix CONDITION_MAPPING * use config file for load mapping * Simplify condition mapping retrieval in FormPropertyLogicRule --------- Co-authored-by: Julien Nahum <julien@nahum.net>
This commit is contained in:
@@ -58,21 +58,21 @@ class IntegrationLogicRule implements DataAwareRule, ValidationRule
|
||||
$operator = $condition['value']['operator'];
|
||||
$value = $condition['value']['value'];
|
||||
|
||||
if (!isset(FormPropertyLogicRule::CONDITION_MAPPING[$typeField])) {
|
||||
if (!isset(FormPropertyLogicRule::getConditionMapping()[$typeField])) {
|
||||
$this->isConditionCorrect = false;
|
||||
$this->conditionErrors[] = 'configuration not found for condition type';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isset(FormPropertyLogicRule::CONDITION_MAPPING[$typeField]['comparators'][$operator])) {
|
||||
if (!isset(FormPropertyLogicRule::getConditionMapping()[$typeField]['comparators'][$operator])) {
|
||||
$this->isConditionCorrect = false;
|
||||
$this->conditionErrors[] = 'configuration not found for condition operator';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$type = FormPropertyLogicRule::CONDITION_MAPPING[$typeField]['comparators'][$operator]['expected_type'];
|
||||
$type = FormPropertyLogicRule::getConditionMapping()[$typeField]['comparators'][$operator]['expected_type'];
|
||||
|
||||
if (is_array($type)) {
|
||||
$foundCorrectType = false;
|
||||
|
||||
Reference in New Issue
Block a user