diff --git a/Database/ActiveRecord.php b/Database/ActiveRecord.php index e0de3197..ac3f3f68 100644 --- a/Database/ActiveRecord.php +++ b/Database/ActiveRecord.php @@ -152,7 +152,6 @@ class ActiveRecord extends BaseActiveRecord if (empty($condition)) { $condition = [$this->getPrimary() => $this->getPrimaryValue()]; } - $condition = static::find()->where($condition)->getCondition(); $execute = static::getDb()->createCommand() ->mathematics(self::getTable(), [$action => $columns], $condition); if ($execute instanceof Command) { diff --git a/Database/Command.php b/Database/Command.php index 303e2769..ac45feb9 100644 --- a/Database/Command.php +++ b/Database/Command.php @@ -144,7 +144,7 @@ class Command extends Component public function mathematics($tableName, $param, $condition): bool|static { $change = $this->db->getSchema()->getChange(); - $sql = $change->mathematics($tableName, $param, $condition); + $sql = $change->mathematics($tableName, $param, [$condition]); if ($sql === false) { return false; } diff --git a/Database/Orm/Condition.php b/Database/Orm/Condition.php index 64d10194..81f2f790 100644 --- a/Database/Orm/Condition.php +++ b/Database/Orm/Condition.php @@ -102,7 +102,6 @@ trait Condition private function conditionMap($condition): string { $array = []; - var_dump($condition); if (is_string($condition) || empty($condition)) { return $condition; } @@ -227,25 +226,4 @@ trait Condition return ' LIMIT ' . $query->limit; } - - /** - * @param $value - * @param bool $isSearch - * @return int|string - */ - public function valueEncode($value, $isSearch = false): int|string - { - if ($isSearch) { - return $value; - } - if (is_numeric($value)) { - return $value; - } else { - if (!is_null(Json::decode($value))) { - return $value; - } - return '\'' . Str::encode($value) . '\''; - } - } - }