Closed (works as designed)
Project:
Configuration Update Manager
Version:
8.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
10 Feb 2015 at 01:03 UTC
Updated:
13 Feb 2015 at 18:37 UTC
Jump to comment: Most recent
Comments
Comment #1
nedjoI thought I'd seen a place where this was handled in core but when I looked in
ConfigImporterI couldn't find it.Comment #2
nedjoI was thinking of e.g. the documentation in
StorageComparer::addChangelistCreate():Comment #3
jhodgdonYeah, but that is for a bulk operation, which this module doesn't do. It's only importing a single config item.
The relevant thing to compare (which I haven't looked at yet but will) is what happens when you go to the core Config manager page that imports a single config from a paste, vs. what happens here if you do a revert or import.
Comment #4
jhodgdonOK. If you take a look at what happens in
\Drupal\config\Form\ConfigSingleImportForm
(in Drupal Core) in the submitForm() method
vs. what is happening in
\Drupal\config_update\ConfigReverter
(in this module) in the import() and revert() methods, you will see that they are pretty much identical (this is not a coincidence).
My feeling is that if Core doesn't care about dependency handling when importing config, I don't need to either.
Comment #5
nedjoUsing the single import form, I tested importing a field before its field storage and got the error " Attempt to create a field field_example that does not exist on entity type node."
ConfigSingleImportForm::submitForm() uses try/catch for the entity save, which will catch an exception if dependencies are missing (or the save fails for any other reason).
So it's probably worth considering using try/catch for the entity saves in the import and update.
Comment #6
jhodgdonWell, the only thing I'm doing different is not catching the exception. If tries to import config that won't import, then they'll get an exception rather than a nicer message. It will not screw up their system, however.
Since it should not screw up their system, I'm not too inclined to worry about this, but if you would like you can file a UI bug.
Comment #7
nedjoI opened #2426189: More user-friendly exception/error handling on revert and import.
Beyond error handling, there are workflow challenges. Taking the example I tried above, after trying to import a field and hitting an error, the workflow might include:
Of course, this is the simplest case. There might be a more extensive dependency chain to follow.
Options to make the workflow easier might be:
None of this is done in core's import of a single config item. But there we don't have access to the required updates.
Comment #8
jhodgdonLet's discuss that on the other (open) issue rather than on this (closed) issue.