Last active
March 1, 2018 16:26
-
-
Save alex-moreno/30be9b0029bb38020594a3151417e4dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<pre><code class="language-php"> | |
<php | |
$this->addFieldMapping('field_blob_attachment', 'attachmentid') | |
->sourceMigration('FileBlob'); | |
$this->addFieldMapping('field_blob_attachment:file_class') | |
->defaultValue('MigrateFileFid'); | |
?> | |
</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<pre><code class="language-php"> | |
<?php | |
class FileBlobMigration extends Migration { | |
public function __construct() { | |
$query = db_select('legacy_file_data', 'f') | |
->fields('f', array('attachmentid', 'attachmentblob', 'filename', 'file_ownerid')); | |
$this->source = new MigrateSourceSQL($query); | |
$this->destination = new MigrateDestinationFile('file', 'MigrateFileBlob'); | |
$this->addFieldMapping('value', 'attachmentblob'); | |
$this->addFieldMapping('destination_file', 'filename'); | |
$this->addFieldMapping('uid', 'file_ownerid') | |
->sourceMigration('User'); | |
?> | |
</code></pre> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<pre><code class="language-php"> | |
<?php | |
$this-addFieldMapping('field_image', 'image_filename'); | |
$this->addFieldMapping('field_image:source_dir') | |
->defaultValue('/mnt/files'); | |
$this->addFieldMapping('field_image:alt', 'image_alt'); | |
$this->addFieldMapping('field_image:title', 'image_title'); | |
?> | |
</code></pre> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment