Merge pull request #17686 from kamil-tekiela/Allow-fields-to-be-set-to-null

Allow fields to be set to NULL
This commit is contained in:
Maurício Meneghini Fauth 2022-08-18 23:33:11 -03:00 committed by GitHub
commit 9c3ce37491
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 0 deletions

View File

@ -1673,6 +1673,7 @@ class InsertEdit
. ' = ' . $currentValueAsAnArray;
} elseif (
! (empty($multiEditFuncs[$key])
&& empty($multiEditColumnsNull[$key])
&& isset($multiEditColumnsPrev[$key])
&& $currentValue === $multiEditColumnsPrev[$key])
&& $currentValueAsAnArray !== ''

View File

@ -2143,6 +2143,30 @@ class InsertEditTest extends AbstractTestCase
],
$result
);
// Test to see if a field can be set to NULL
$result = $this->insertEdit->getQueryValuesForInsertAndUpdateInMultipleEdit(
$multi_edit_columns_name,
['on'],
'',
[''],
[],
false,
[],
[],
'NULL',
[],
'0',
[]
);
$this->assertEquals(
[
['`fld` = NULL'],
[],
],
$result
);
}
/**