Skip to content

Commit

Permalink
rm empty string to null save typecasting
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek committed May 28, 2024
1 parent 9b7c484 commit 13ac723
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
4 changes: 0 additions & 4 deletions src/Persistence.php
Original file line number Diff line number Diff line change
Expand Up @@ -503,10 +503,6 @@ protected function _typecastSaveField(Field $field, $value)
{
$value = $this->_typecastPreField($field, $value, false);

if (in_array($field->type, ['json', 'object'], true) && $value === '') { // TODO remove later
return null;
}

// native DBAL DT types have no microseconds support
if ($value !== null && in_array($field->type, ['datetime', 'date', 'time'], true)
&& str_starts_with(get_class(Type::getType($field->type)), 'Doctrine\DBAL\Types\\')
Expand Down
3 changes: 2 additions & 1 deletion tests/TypecastingTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ public function testEmptyValues(): void
self::assertNull($mm->get('local-object'));

unset($row['id']);
unset($row['local-object']);
$row['json'] = null;
$row['local-object'] = null;
$mm->setMulti($row);

self::assertSame($fixEmptyStringForOracleFx(''), $mm->get('string'));
Expand Down

0 comments on commit 13ac723

Please sign in to comment.