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.
Comments
Comment #2
RumyanaRuseva commentedHere is a patch.
Comment #3
captainpants commentedThis is also an issue when migrating from D7 to D8 sites. Patch #2 works like a charm.
Comment #4
captainpants commentedComment #5
heddnI think this needs a test. So back to NW. Great find by the way.
Comment #6
RumyanaRuseva commentedComment #7
mpp 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 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 commentedUpdated the entity count to fix the test.
Comment #13
mpp 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 commentedCommenting just to mention that the patch at #11 applies to
8.5.xtoo, at least on8.5.6.I am getting the same problem in
8.5.x, in my case related tod7_entity_reference_translationmigration.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++