*
* @since 1.20
*
- * @param $name string: Field name
+ * @param string $name Field name
* @param $default mixed: Default value to return when none is found
* (default: null)
*
if ( array_key_exists( $name, $this->fields ) ) {
$value = $this->fields[$name];
+ // Skip null id fields so that the DBMS can set the default.
+ if ( $name === 'id' && is_null ( $value ) ) {
+ continue;
+ }
+
switch ( $type ) {
case 'array':
$value = (array)$value;