Fix: not null not checked with type
This commit is contained in:
parent
acd024998b
commit
d49baac317
|
@ -139,6 +139,9 @@ class Model{
|
||||||
|
|
||||||
protected static function convertField($data, $field){
|
protected static function convertField($data, $field){
|
||||||
$options = static::getOptions($field);
|
$options = static::getOptions($field);
|
||||||
|
if(is_null($data) && isset($options['not_null']) && $options['not_null'] == true)
|
||||||
|
throw new DatabaseException('Can\'t set null to NOT NULL field : '.$field);
|
||||||
|
|
||||||
if(isset($options['type'])){
|
if(isset($options['type'])){
|
||||||
switch(strtolower($options['type'])){
|
switch(strtolower($options['type'])){
|
||||||
case 'int':
|
case 'int':
|
||||||
|
@ -157,9 +160,6 @@ class Model{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(is_null($data) && isset($options['not_null']) && $options['not_null'] == true)
|
|
||||||
throw new DatabaseException('Can\'t set null to NOT NULL field : '.$field);
|
|
||||||
|
|
||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue