This commit is contained in:
2020-08-31 12:38:32 +08:00
parent 683a39dded
commit 65c443ec87
126 changed files with 7369 additions and 228 deletions
+34
View File
@@ -0,0 +1,34 @@
<?php
namespace Database\Condition;
use Database\ActiveQuery;
/**
* Class InCondition
* @package Database\Condition
*/
class InCondition extends Condition
{
/**
* @return string
* @throws \Exception
*/
public function builder()
{
if ($this->value instanceof ActiveQuery) {
$this->value = $this->value->getBuild()->getQuery($this->value);
} else {
$this->value = array_filter($this->format($this->value));
if (empty($this->value)) {
return '';
}
$this->value = implode(',', $this->value);
}
return '`' . $this->column . '` in(' . $this->value . ')';
}
}