This commit is contained in:
2021-02-24 18:34:57 +08:00
parent 22148402b6
commit 9024c7c3ab
21 changed files with 245 additions and 349 deletions
+8 -8
View File
@@ -3,6 +3,8 @@ declare(strict_types=1);
namespace Database\Condition;
use JetBrains\PhpStorm\Pure;
/**
* Class NotInCondition
* @package Database\Condition
@@ -12,17 +14,15 @@ class NotInCondition extends Condition
/**
* @return string
* @return string|null
*/
public function builder(): string
#[Pure] public function builder(): ?string
{
$format = array_filter($this->format($this->value));
if (empty($format)) {
return '';
if (!is_array($this->value)) {
return null;
}
return '`' . $this->column . '` not in(' . implode(',', $format) . ')';
$value = '\'' . implode('\',\'', $this->value) . '\'';
return '`' . $this->column . '` not in(' . $value . ')';
}
}