Problem/Motivation
Running the d6_field_formatter_settings migration, with multiples fields type (text, link, date), only date are "created". Other are "failed".
The message logged is, for example:
Failed to lookup field type array (
0 => 'link',
1 => 'default',
) in the static map.
After a long investigation I found that this is due to /core/modules/field/src/Plugin/migrate/process/d6/FieldTypeDefaults.php
Although it does trigger a MigrateException (= message), IMHO it misses a more explicit explanation like:
text/link/xxx field migration does not provide yet support migrating default-value
(+ using ignored rather than failed).
That would avoid one to think that the migration somehow failed.
Also, the code does not explains why it only migrate "date" default value and not the other field types.
Proposed resolution
Change the MigrateException message in d6/FieldTypeDefaults process plugin from
Failed to lookup field type %s in the static map.
to
No default field type found for field type %s
Remaining tasks
Review
Commit
| Comment | File | Size | Author |
|---|---|---|---|
| #21 | 2831531-21.patch | 1.64 KB | quietone |
Comments
Comment #3
joelpittetI'm still trying to figure out what it expects and where to fix this. I agree with the issue summary, the very least would be to provide more information in the exception.
Comment #4
joelpittetComment #5
heddnComment #10
heddnCould use some tests and a patch.
Comment #13
quietone commentedSo, the recommendation here is to improve the message thrown in d6/FieldTypeDfaults to assist fixing the problem.
throw new MigrateException(sprintf('Failed to lookup field type %s in the static map.', var_export($value, TRUE)))The suggestion is "text/link/xxx field migration does not provide yet support migrating default-value". Since there are many field migrations (field, field_instance etc) using that phrase won't be clear. How about this:
No default value available for destination property '%s' for field type '%s'Opinions?
Comment #14
quietone commentedIf #2976098: MigrateExecutable should add details for the migration & destination property to exceptions that cause a row failure is committed then the message will include the migration and the destination property. With the migration and destination property it is a simple task to look at the relevant process. In this case it is a static_map with a long list of mappings. The next question then is what value caused the exception. And we have that information, it is provided in the existing exception message. So, now it should be a straightforward fix to add the missing mapping.
Given that I think this is probably a won't fix.
Comment #21
quietone commentedd6_field_formatter_settings:options/type:d6_field_type_defaults: No default type found for field type 'text_default'Comment #22
smustgrave commentedError message matches the proposed solution and seems to give the additional information needed.
Comment #23
quietone commentedJust improving the Issue Summary and title.
Comment #25
quietone commentedThe Migrate Drupal Module was approved for removal in #3371229: [Policy] Migrate Drupal and Migrate Drupal UI after Drupal 7 EOL.
This is Postponed. The status is set according to two policies. The Remove a core extension and move it to a contributed project and the Extensions approved for removal policies.
The deprecation work is in #3522602: [meta] Tasks to remove Migrate Drupal module and the removal work in #3522602: [meta] Tasks to remove Migrate Drupal module.
Migrate Drupal will not be moved to a contributed project. It will be removed from core after the Drupal 12.x branch is open.
Comment #26
quietone commentedThe Migrate Drupal and Migrate Drupal UI modules are deprecated and will be removed from Drupal 12. For these modules, effort is now focused on bug fixes and necessary tasks. Therefore, this feature request is closed as won't fix.
Thanks to all for working on this!