How to...
Persist unfilled text as empty strings instead of null
Neos has chosen to represent and persist an unfilled value with null on an optional string.
This can pose a problem with an existing database in which the choice of an empty string had been made to persist unfilled texts.
To answer this specific case, we explain here how to configure your data columns and entity properties.
Warning
This case is presented here only to ensure compatibility with an existing database. It is incompatible with Oracle, as storing empty strings is not allowed with this database engine.
The metadata of the database column should be configured as follows:
- Data type: String
- Required: true (as unfilled values are represented by an empty string, there must never be null)
- Default value: =string.Empty (this particular value is not to be used outside the case described here)
The metadata of the entity property should be configured as follows:
- Data type: String
- Required: false
This setting provides standard Neos behavior for entities, entity views and UI views, while preserving the legacy persistence mode.