Closed (fixed)
Project:
Migrate Extras
Version:
7.x-2.x-dev
Component:
Media
Priority:
Normal
Category:
Support request
Assigned:
Unassigned
Reporter:
Created:
24 Apr 2012 at 23:22 UTC
Updated:
24 May 2012 at 21:00 UTC
I am trying to migrate some files and the old system had custom table with a number of fields that I want to attach to the migrated files. I've added the entity fields, but my migration doesn't want to add them to the entity.
$this->destination = new MigrateDestinationFile('file', 'MigrateFileUri');
$this->addFieldMapping('value', 'filename');
$this->addFieldMapping('source_dir')->defaultValue($this->file_source_dir);
$this->addFieldMapping('destination_dir')->defaultValue('public://');
$this->addFieldMapping('destination_file', 'filename');
$this->addFieldMapping('field_slideshow_tf', 'slideshow_tf');
$this->addFieldMapping('timestamp', 'file_date');
The file looks right and has the right fields for everything but the slideshow_tf field. If I print_r($entity) in prepare() it looks fine, I can see that field. No errors or warnings are being thrown, and the file is copied to the destination correctly; this is the only problem I'm having.
I am using 7.x-2.3+25-dev of the migrate module. Am I missing something?
Comments
Comment #1
mikeryanWhat field type is field_slideshow_tf? Is it a core field type, or a field type supported by Migrate Extras? If not, then support for that field type would need to be implemented.
Comment #2
smichel commentedThat field -- field_slideshow_tf -- is a boolean. I have the same problems with some text fields, indeed with any fields attached to the file entity.
Comment #3
mikeryan"needs review" means there's a patch that needs review. The right status for an open support request is "active".
I'll see if I can reproduce this.
Comment #4
mikeryanHow exactly are you adding fields to the file entity? Are you using the Media module? If so, are you using Migrate Extras? That's where the migration support for Media is...
Comment #5
smichel commentedOK, thanks for the status tip.
Yes, through the media module. I'll give that a shot.
Comment #6
mikeryanOK, moving to the Migrate Extras queue - it doesn't look like the Media integration currently supports this.
Comment #7
steinmb commentedHi
Care to elaborate on what's working and what is not? If I understand you correct above are we unable to populate fields added to a file_entity by using migrate/migrate_media?
Comment #8
mikeryanSeems to work fine, actually - you just need to pass the file type (bundle) to MigrateDestinationFile. I.e., if you've added fields to the Image file type, in your migration constructor you do
and the fields are exposed.
@steinmb: The Media module has come a long way from its early days in terms of integrating with the core file entity, so right now there doesn't seem to be a lot for migrate_extras to do to support it. This is what it does today:
1. From an entity (node, user, term) prepare() method, you can call MigrateDestinationMedia::rewriteImgTags($entity, $field='body') to replace <img> tags in the specified field with media tags.
2. It adds another file class in addition to the built-in MigrateFileUri etc., MigrateExtrasFileYoutube, which will take a Youtube URL and create the proper file entity for it.
I haven't had any use cases beyond those so far, but if anyone has any additional needs for the media integration, please open a feature request.