One would expect to be able to copy the yaml of a webform into a module's config/install folder, remove the uuid, and import it using config_devel's cdi command, as you can with other configurations. However, it fails due to a bogus uuid conflict because:
1) ConfigDevelAutoImportSubscriber::importOne() first creates the new entity and THEN loads the existing one to set the new entity's uuid (if absent) from the existing one.
2) WebformEntityStorage::doCreate() caches the newly-created entity, even though it hasn't been saved yet.
3) Therefore importOne() retrieves the entity it just created, rather than the existing one. The uuid in the new entity is updated to match the existing entity.
4) This could be fixed by having config_devel load the existing entity before creating the new one. Or maybe webform shouldn't be caching an entity that hasn't actually been saved yet?
Feel free to move to the config_devel issue queue if appropriate.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | 3059507-2.patch | 624 bytes | jrockowitz |
Comments
Comment #2
jrockowitz commentedDoes the attached patch solve the problem?
Comment #3
danchadwick commentedYes. Assuming you've tested the case where caching is needed, this is RTBC.
Thank you for your near-instantaneous response to this minor issue. Much gratitude.
Comment #5
jrockowitz commented