I'm running the latest devs of migrate, migrate_d2d, and file_entity. When trying to import my files I keep getting the following error, one for each file:
Missing bundle property on entity of type file. [error (/home/sam/www/gateway/docroot/includes/common.inc:7635)
Backtrace is as follows:
| 1 0 entity_extract_ids() /home/sam/www/gateway/docroot/includes/common.inc:7633
| 2 1 _field_invoke() /home/sam/www/gateway/docroot/modules/field/field.attach.inc:191
| 3 2 _field_invoke_default() /home/sam/www/gateway/docroot/modules/field/field.attach.inc:386
| 4 3 MigrateDestinationEntity->prepare() /home/sam/www/gateway/docroot/sites/all/modules/contrib/migrate/plugins/destinations/entity.inc:144
| 5 4 MigrateDestinationFile->import() /home/sam/www/gateway/docroot/sites/all/modules/contrib/migrate/plugins/destinations/file.inc:627
| 6 5 Migration->import() /home/sam/www/gateway/docroot/sites/all/modules/contrib/migrate/includes/migration.inc:570
-| 7 6 MigrationBase->processImport() /home/sam/www/gateway/docroot/sites/all/modules/contrib/migrate/includes/base.inc:878
| 8 7 drush_migrate_import() /home/sam/www/gateway/docroot/sites/all/modules/contrib/migrate/migrate.drush.inc:1126
| 9 8 call_user_func_array() /usr/share/php/drush/includes/command.inc:0
| 10 9 _drush_invoke_hooks() /usr/share/php/drush/includes/command.inc:324
| 11 10 drush_command() /usr/share/php/drush/includes/command.inc:198
| 12 11 call_user_func_array() /usr/share/php/drush/includes/command.inc:0
| 13 12 drush_dispatch() /usr/share/php/drush/includes/command.inc:165
| 14 13 _drush_bootstrap_and_dispatch() /usr/share/php/drush/drush.php:92
| 15 14 drush_main() /usr/share/php/drush/drush.php:61
| 16 15 {main} /usr/share/php/drush/drush.php:16
The code in entity_extract_info() looks like this:
if (!isset($entity->{$info['entity keys']['bundle']}) || $entity->{$info['entity keys']['bundle']} === '') {
throw new EntityMalformedException(t('Missing bundle property on entity of type @entity_type.', array('@entity_type' => $entity_type)));
}
The first part of the condition never passes because $entity->type is not set (i think).
In a bit over my head here but I'll keep digging.
Comments
Comment #1
samhassell commentedThis one-liner looks to fix the issue, though i had to go and update my original site with the latest file_entity as well.
Comment #2
pengo commentedFixed link for above patch:
http://drupal.org/files/migrate_d2d_file_entity_missing_bundle-%23190164...
(Drupal.org isn't url-encoding the
#symbol in the filename)Comment #3
mikeryanActually, the issue is that file_entity uses 'type' as the bundle field, so Migrate's destination plugin needs to set the with the configured bundle.
Comment #4
mikeryanCommitted, to the wizard_api branch for now, to be merged to 7.x-2.x later.
Comment #6
andyg5000Here's the commit diff so people know what to change until it get's committed to 7.x-2.x-dev
http://drupalcode.org/project/migrate.git/blobdiff/d4db496beebb721246482...
Comment #7
andyg5000I actually still get the Missing bundle property on entity of type file error with the fix above. Moving $file->type = $this->bundle; outside of the if ($migration->getSystemOfRecord() == Migration::DESTINATION) condition fixes the issue for me.
Comment #8
lex0r commented@andyg5000: thanks for the diff!
This fix should be merged into 2.x branch. Got git workflow? :)
Comment #9
mikeryanThe wizard_api branch will be merged back to 7.x-2.x soon enough.
Comment #9.0
mikeryansome stuff was wrong.