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

samhassell’s picture

Project: Migrate » Drupal-to-Drupal data migration
Component: Code » D7-specific
Status: Active » Needs review
StatusFileSize
new437 bytes

This one-liner looks to fix the issue, though i had to go and update my original site with the latest file_entity as well.

pengo’s picture

Fixed 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)

mikeryan’s picture

Project: Drupal-to-Drupal data migration » Migrate
Component: D7-specific » Code
Status: Needs review » Needs work

Actually, 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.

mikeryan’s picture

Status: Needs work » Fixed

Committed, to the wizard_api branch for now, to be merged to 7.x-2.x later.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

andyg5000’s picture

Here'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...

andyg5000’s picture

Status: Closed (fixed) » Active

I 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.

lex0r’s picture

@andyg5000: thanks for the diff!
This fix should be merged into 2.x branch. Got git workflow? :)

mikeryan’s picture

Status: Active » Closed (fixed)

The wizard_api branch will be merged back to 7.x-2.x soon enough.

mikeryan’s picture

Issue summary: View changes

some stuff was wrong.