Problem/Motivation
Drupal\content_translation\Plugin\migrate\source\I18nQueryTrait is also used in multiple migrate source plugins of other modules (e.g. Drupal\block_content\Plugin\migrate\source\d7\BlockCustomTranslation). This may make sense as translations usually require to have content_translation enabled. However it prevents e.g. the type checking of such plugins without instantiating them, as done in https://www.drupal.org/project/entity_import, Drupal\entity_import\EntityImportSourceManager::getDefinitions().
Steps to reproduce
- Install Drupal standard installation profile in English, make sure content_translation is not enabled
- Install migrate_drupal module
- Install https://www.drupal.org/project/entity_import
- Login in and go to /admin/config/system/entity-importer/add (Content > Importers > entity importer creation page)
Instead of displaying a form to add an entity importer, the following fatal error occurs:
Trait 'Drupal\content_translation\Plugin\migrate\source\I18nQueryTrait' not found in /var/www/html/web/core/modules/block_content/src/Plugin/migrate/source/d7/BlockCustomTranslation.php on line 22
Proposed resolution
I18nQueryTrait is used in the context of migrations and the migrate module already contains Drupal\migrate\Plugin\migrate\source\DummyQueryTrait. Hence it seems reasonable to move Drupal\content_translation\Plugin\migrate\source\I18nQueryTrait to Drupal\migrate\Plugin\migrate\source\I18nQueryTrait in order to avoid unnecessary dependencies.
User interface changes
None.
API changes
None.
Data model changes
None.
Comment | File | Size | Author |
---|---|---|---|
#6 | 3258581-6.patch | 9.71 KB | merlin06 |
Issue fork drupal-3258581
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
boromino CreditAttribution: boromino at LakeDrops commentedComment #4
boromino CreditAttribution: boromino at LakeDrops commentedComment #5
boromino CreditAttribution: boromino at LakeDrops commentedComment #6
merlin06 CreditAttribution: merlin06 at Australian Competition and Consumer Commission (ACCC) commentedPatch applies against 9.3.3
Comment #7
merlin06 CreditAttribution: merlin06 at Australian Competition and Consumer Commission (ACCC) commentedSorry, I didn't intend to change the version number.
Comment #8
quietone CreditAttribution: quietone at PreviousNext commentedI tested this on 9.4.x, standard install and was not able to reproduce this error. I followed the steps given in the Issue Summary. Is there something else that needs to be done? Changing status to get more information.
The migrate maintainers work from the 'migration system' component, changing component.
This isn't a feature request and although I can't reproduce the problem, changing to a bug report.
Comment #9
sanduhrsJust ran into the exact same issue while trying to install entity_import module.
The 'Add entity importer' just gives a WSOD.
Comment #10
quietone CreditAttribution: quietone at PreviousNext commented@sanduhrs, thanks for reporting the problem.
I am still not able to reproduce the problem using the steps in the Issue Summary.
Doing more research I see that In the related issue the explanation for the problem is given and so is the workaround. I suggest using that method.
The i18nQuery trait is only needed for migrating a drupal database and thus will not be moving to the migrate module. What could be done in core is add checkRequirements to the source plugins using the trait to ensure that content_translation is enabled. Assigning this to myself to consider that later.
Comment #11
boromino CreditAttribution: boromino at LakeDrops commentedSorry for the confusion, migrate_drupal module has to be installed, too. I edited the issue description accordingly.
@quietone I see your point regarding migrate module.
Would you consider to add the trait to the migrate_drupal module, instead? Then I would provide a patch for that.As entity_import does not require migrate_drupal, another work-around makes probably more sense.Comment #15
quietone CreditAttribution: quietone at PreviousNext commentedI think this will be fixed by #3332998: Move migration code from content_translation to migrate_drupal