This commit is contained in:
as2252258@163.com
2021-02-28 00:50:30 +08:00
parent 6d5eb9e5b0
commit a29420299a
2 changed files with 7 additions and 13 deletions
-8
View File
@@ -47,17 +47,9 @@ abstract class Condition extends BaseObject
*/ */
public function setValue($params): void public function setValue($params): void
{ {
if (is_object($params)) {
var_dump($params);
$params = get_object_vars($params);
};
if (is_array($params)) { if (is_array($params)) {
$values = []; $values = [];
foreach ($params as $item => $value) { foreach ($params as $item => $value) {
if (is_object($value)) {
var_dump($value);
continue;
};
$values[$item] = is_numeric($value) ? $value : '\'' . $value . '\''; $values[$item] = is_numeric($value) ? $value : '\'' . $value . '\'';
} }
$this->value = $value; $this->value = $value;
+7 -5
View File
@@ -200,15 +200,17 @@ trait Builder
if (!is_string($condition[2])) { if (!is_string($condition[2])) {
$condition[2] = $this->_hashMap($condition[2]); $condition[2] = $this->_hashMap($condition[2]);
} }
return Snowflake::createObject(['class' => OrCondition::class, 'value' => $condition[2], 'column' => $condition[1], 'oldParams' => $array]); $builder = Snowflake::createObject(['class' => OrCondition::class, 'value' => $condition[2], 'column' => $condition[1], 'oldParams' => $array]);
} }else if (isset(ConditionClassMap::$conditionMap[$stroppier])) {
if (isset(ConditionClassMap::$conditionMap[$stroppier])) {
$defaultConfig = ConditionClassMap::$conditionMap[$stroppier]; $defaultConfig = ConditionClassMap::$conditionMap[$stroppier];
$create = array_merge($defaultConfig, ['column' => $condition[1], 'value' => $condition[2]]); $create = array_merge($defaultConfig, ['column' => $condition[1], 'value' => $condition[2]]);
$array[] = Snowflake::createObject($create); $builder = Snowflake::createObject($create);
} else { } else {
$array[] = Snowflake::createObject(['class' => HashCondition::class, 'value' => $condition]); $builder = Snowflake::createObject(['class' => HashCondition::class, 'value' => $condition]);
} }
$array[] = $builder->builder();
return implode(' AND ', $array); return implode(' AND ', $array);
} }