diff --git a/build/database/repo/machine.php b/build/database/repo/machine.php index c9f002c..efc27b1 100755 --- a/build/database/repo/machine.php +++ b/build/database/repo/machine.php @@ -27,8 +27,8 @@ 'id_machine' => Rows::INSERT_DEFAULT, 'id_warehouse' => $id_warehouse, 'name' => $name, - 'token' => Rows::NULL, - 'unlock_code' => Rows::NULL + 'token' => null, + 'unlock_code' => null ]); // Si erreur (car name doit être unique) diff --git a/build/orm/core/Rows.php b/build/orm/core/Rows.php index 75ec804..0bd7592 100755 --- a/build/orm/core/Rows.php +++ b/build/orm/core/Rows.php @@ -664,6 +664,8 @@ foreach($set as $field=>$value){ + if( is_null($value) ) continue; + $type = $this->schema['columns'][$field]['type']; // {1} Si de type INT/FLOAT et pas numérique, on retire le champ // @@ -713,6 +715,7 @@ // Si l'entrée est donnée if( isset($set[$field]) ) if( $set[$field] == self::INSERT_DEFAULT ) $requestS .= 'DEFAULT'; // On insère directement les valeurs 'DEFAULT' + else if( is_null($set[$field]) ) $requestS .= 'NULL'; else $requestS .= ':insert_'.$field.'_'.$i; else $requestS .= 'DEFAULT';