Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
My entity definition has a string field whose default value should be ''
However whereever I specify in the entity creation and saving process that the field should be a string, NULL is written to the db.
I can't find a similar use-case in core to check if I'm doing something wrong.
This looks related to https://www.drupal.org/node/2318605
Here is my full field definition
$fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t('Name'))
->setDescription(t("Description"))
->setSetting('max_length', 64)
->setDefaultValue('');
Comments
Comment #2
dawehnerYeah known issue. See #2567899: Empty node titles cause failures when migrating because empty strings are treated as NULL for all the fun!