This commit is contained in:
2023-04-07 18:23:27 +08:00
parent 6d122c4ae1
commit 5d41c7219f
9 changed files with 339 additions and 328 deletions
+4 -5
View File
@@ -12,17 +12,16 @@ class HashCondition extends Condition
/**
* @return string
* @throws \Exception
*/
public function builder(): string
{
$array = [];
if (empty($this->value)) {
return '';
if (count($this->value) < 1) {
throw new \Exception('Builder data by a empty array.');
}
foreach ($this->value as $key => $value) {
if (is_null($value)) continue;
$array[] = sprintf("%s = '%s'", $key, addslashes($value));
$array[] = $key . '=' . addslashes($value);
}
return implode(' AND ', $array);
}