modify
This commit is contained in:
@@ -14,45 +14,46 @@ use Snowflake\Core\Str;
|
|||||||
abstract class Condition extends BaseObject
|
abstract class Condition extends BaseObject
|
||||||
{
|
{
|
||||||
|
|
||||||
protected string $column = '';
|
protected string $column = '';
|
||||||
protected string $opera = '=';
|
protected string $opera = '=';
|
||||||
|
|
||||||
/** @var array|mixed */
|
/** @var array|mixed */
|
||||||
protected $value;
|
protected $value;
|
||||||
|
|
||||||
const INT_TYPE = ['bit', 'bool', 'tinyint', 'smallint', 'mediumint', 'int', 'bigint', 'float', 'double', 'decimal', 'timestamp'];
|
const INT_TYPE = ['bit', 'bool', 'tinyint', 'smallint', 'mediumint', 'int', 'bigint', 'float', 'double', 'decimal', 'timestamp'];
|
||||||
|
|
||||||
protected array $attributes = [];
|
protected array $attributes = [];
|
||||||
|
|
||||||
abstract public function builder();
|
abstract public function builder();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $column
|
* @param string $column
|
||||||
*/
|
*/
|
||||||
public function setColumn(string $column): void
|
public function setColumn(string $column): void
|
||||||
{
|
{
|
||||||
$this->column = $column;
|
$this->column = $column;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $opera
|
* @param string $opera
|
||||||
*/
|
*/
|
||||||
public function setOpera(string $opera): void
|
public function setOpera(string $opera): void
|
||||||
{
|
{
|
||||||
$this->opera = $opera;
|
$this->opera = $opera;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $value
|
* @param $value
|
||||||
*/
|
*/
|
||||||
public function setValue($value): void
|
public function setValue($value): void
|
||||||
{
|
{
|
||||||
$this->value = is_numeric($value) ? $value : '\'' . $value . '\'';
|
if (is_array($value)) {
|
||||||
if (is_array($this->value)) {
|
$this->value = array_map(function ($_value) {
|
||||||
$this->value = array_map(function ($value) {
|
return is_numeric($_value) ? $_value : '\'' . $_value . '\'';
|
||||||
return is_numeric($value) ? $value : '\''.$value.'\'';
|
}, $value);
|
||||||
}, $this->value);
|
} else {
|
||||||
}
|
$this->value = is_numeric($value) ? $value : '\'' . $value . '\'';
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user