Problem/Motivation
If there is a field, which properties are based on the how the field storage definition is configured, then under some circumstances it might happen that the returned properties by BaseFieldDefinition::getPropertyDefinitions and FieldStorageConfig::getPropertyDefinitions are obsolete.
$field_storage_config->getPropertyDefintions();
$field_storage_config->set('settings', $new_settings); OR $field_storage_config->setSettings($new_settings); OR $field_storage_config->setSetting('dynamic_property_setting', $dynamic_property_setting);
$field_storage_config->getPropertyDefintions(); -> returns the previous locally cached property definitions.
The problem occurs when the field is being re-configured over the field storage config UI and according to a changed setting a new property will be added - in this case an exception will be thrown from SqlContentEntityStorageSchema::getDedicatedTableSchema(), because the new column will be present, but not the property definition for the new property.
Proposed resolution
BaseFieldDefinition::setSetting(), BaseFieldDefinition::setSettings(), FieldStorageConfig::setSetting() and FieldStorageConfig::setSettings()
should clear the local cache for the property definitions.
Implementation details:
FieldStorageConfig::setSetting()
and FieldStorageConfig::set()
should both call FieldStorageConfig::setSettings()
, which takes care of reseting the local cache of property definitions.
BaseFieldDefinition::setSetting()
and BaseFieldDefinition::setSettings()
should both call BaseFieldDefinition::setItemDefinitionSetting()
, which takes care of reseting the local cache of property definitions.
Remaining tasks
User interface changes
API changes
Data model changes