Brutal insert speed optimization by bypassing the ORM completely
This commit is contained in:
@@ -187,20 +187,21 @@ class Column implements JsonSerializable, Arrayable
|
||||
{
|
||||
switch ($this->type) {
|
||||
case 'int':
|
||||
if (is_null($value)) return 0;
|
||||
if (is_null($value) || $value === "") return 0;
|
||||
if (is_int($value)) return $value;
|
||||
if (is_bool($value)) return (int)$value;
|
||||
if (is_float($value)) return round($value);
|
||||
if (is_numeric($value)) return intval($value);
|
||||
throw new SimpleValidationException($this->id, "Could not convert value \"$value\" to int!");
|
||||
|
||||
case 'float':
|
||||
if (is_null($value)) return 0;
|
||||
if (is_int($value) || is_float($value)) return (float)$value;
|
||||
if (is_null($value) || $value === "") return 0;
|
||||
if (is_int($value) || is_float($value) || is_bool($value)) return (float)$value;
|
||||
if (is_numeric($value)) return floatval($value);
|
||||
throw new SimpleValidationException($this->id, "Could not convert value \"$value\" to float!");
|
||||
|
||||
case 'bool':
|
||||
if (is_null($value)) return false;
|
||||
if (is_null($value) || $value === "") return false;
|
||||
return Utils::parseBool($value);
|
||||
|
||||
case 'string':
|
||||
|
||||
Reference in New Issue
Block a user