Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Problem/Motivation
The following error occurs on `drush ms` when there is a non-bundleable entity type (in this case Linkback):
InvalidArgumentException: A bundle was provided but the entity type (linkback) is not bundleable. in [error]
/core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php:112
Stack trace:
#0 /core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php(133): Drupal\migrate_drupal\Plugin\migrate\source\ContentEntity->__construct(Array,
'content_entity:...', Array, Object(Drupal\migrate\Plugin\Migration), Object(Drupal\Core\Entity\EntityTypeManager), Object(Drupal\Core\Entity\EntityFieldManager),
Object(Drupal\Core\Entity\EntityTypeBundleInfo))
#1 /core/modules/migrate/src/Plugin/MigratePluginManager.php(57):
Drupal\migrate_drupal\Plugin\migrate\source\ContentEntity::create(Object(Drupal\Core\DependencyInjection\Container), Array, 'content_entity:...', Array,
Object(Drupal\migrate\Plugin\Migration))
...
This is caused by the migration d6_entity_reference_translation calling EntityReferenceTranslationDeriver::getDerivativeDefinitions() and setting 'bundle' in the migration source.
Proposed resolution
Check if the entity type has bundles.
Comment | File | Size | Author |
---|---|---|---|
#11 | 2981225-11.patch | 4.38 KB | maxocub |
#11 | 2981225-11-test-only.patch | 1.59 KB | maxocub |
#11 | interdiff-2981225-8-11.txt | 731 bytes | maxocub |
Comments
Comment #2
RumyanaRuseva CreditAttribution: RumyanaRuseva as a volunteer and at FFW commentedHere is a patch.
Comment #3
captainpants CreditAttribution: captainpants commentedThis is also an issue when migrating from D7 to D8 sites. Patch #2 works like a charm.
Comment #4
captainpants CreditAttribution: captainpants commentedComment #5
heddnI think this needs a test. So back to NW. Great find by the way.
Comment #6
RumyanaRuseva CreditAttribution: RumyanaRuseva as a volunteer and at FFW commentedComment #7
mpp CreditAttribution: mpp at AmeXio for District09 commentedThe patch in 2 also fixes the problem for migrations towards custom entities without a bundle:
[error] A bundle was provided but the entity type (mycustom) is not bundleable.
Comment #8
maxocub CreditAttribution: maxocub as a volunteer commentedFor a failing test I just added an entity reference field on the non-bundleable entity user.
The test only patch is the interdiff.
Comment #11
maxocub CreditAttribution: maxocub as a volunteer commentedUpdated the entity count to fix the test.
Comment #13
mpp CreditAttribution: mpp at AmeXio for District09 commentedLooks good, marking as rtbc.
Comment #16
alexpottCredited @mpp for a review confirming this fixes custom non-bundleable entity type migrations.
Committed to 8.6.x and 8.7.x. Thanks!
Comment #18
marvil07 CreditAttribution: marvil07 at Isovera for Pegasystems commentedCommenting just to mention that the patch at #11 applies to
8.5.x
too, at least on8.5.6
.I am getting the same problem in
8.5.x
, in my case related tod7_entity_reference_translation
migration.Not re-opening the issue, since I guess alexpott had a reason to not add the patch to
8.5.x
.Comment #19
vijaycs85#18++