Comments

andrewmacpherson created an issue. See original summary.

andrewmacpherson’s picture

Status: Active » Needs review

This patch provides a Scald Atom entity source. It works much like the D7 node source, pulling in Field API values during prepareRow().

It has an atom_type configuration key, to specify the scald atom bundle in the D7 source data.

I didn't write a migrate source for scald types; these were configured manually in our D8 project.

andrewmacpherson’s picture

Where did the patch go? I think I forgot to press the upload button.

andrewmacpherson’s picture

slashrsm’s picture

Issue tags: +D8Media
dan_metille’s picture

Is this patch still working? And if it is the case is it please possible to have some instruction about how to migrate scald to media entity? Thanks a lot, because I was expecting a much smoother migration process to D8.

heddn’s picture

seanr’s picture

Documentation on this would be much appreciated - an example migration to go along with this patch would be a huge help. Also +1 to Sahaj's question on whether this has been affected by any changes elsewhere.

heddn’s picture

Status: Needs review » Needs work
Issue tags: +Needs tests

For creating a fixture for any testing, see https://www.drupal.org/docs/8/api/migrate-api/generating-database-fixtur...

  1. +++ b/src/Plugin/migrate/source/d7/ScaldAtom.php
    @@ -0,0 +1,85 @@
    + *   source_provider = "scald"
    

    This need a source_module too per https://www.drupal.org/node/2911881

  2. +++ b/src/Plugin/migrate/source/d7/ScaldAtom.php
    @@ -0,0 +1,85 @@
    +      ->fields('s', array(
    

    Rather than list all the fields, can we simplify things and just grab all of them?

  3. +++ b/src/Plugin/migrate/source/d7/ScaldAtom.php
    @@ -0,0 +1,85 @@
    +    if (isset($this->configuration['atom_type'])) {
    +      $query->condition('s.type', $this->configuration['atom_type']);
    

    This feels like a good case for a deriver. I could be wrong.

  4. +++ b/src/Plugin/migrate/source/d7/ScaldAtom.php
    @@ -0,0 +1,85 @@
    +    foreach (array_keys($this->getFields('scald_atom', $row->getSourceProperty('type'))) as $field) {
    +      $sid = $row->getSourceProperty('sid');
    +      $row->setSourceProperty($field, $this->getFieldValues('scald_atom', $field, $sid));
    +    }
    

    Why is this needed? Transforms like this usually happen in a process section of the migration.

seanr’s picture

Status: Needs work » Needs review
StatusFileSize
new2.16 KB

Moving this along a little, I hope...

Status: Needs review » Needs work

The last submitted patch, 10: scald-atom-migrate-source-2772129-10.patch, failed testing. View results

seanr’s picture

Status: Needs work » Needs review

Ugh, I'll try to re-roll that from scratch later today.

andrewmacpherson’s picture

Good to see someone picked this up. The patch I put in place was a work-in-progress as of D8.1. Things like source_module have come along since then.

Re: #9.4

Why is this needed? Transforms like this usually happen in a process section of the migration.

I honestly don't remember. I expect I was still learning my way around wiring up process pipelines in D8. As it happens, the requirement to migrate Scald atoms was dropped from the client project I was working on at the time. It had a mixture of imagefields and scald atoms, and the particular source field that used scald was dropped as a non-essential field. That's the way things go.

seanr’s picture

StatusFileSize
new2.18 KB

Re-rolled

Status: Needs review » Needs work

The last submitted patch, 14: scald-atom-migrate-source-2772129-14.patch, failed testing. View results

seanr’s picture

StatusFileSize
new2.16 KB

Thanks to @jhodgdon updated patch here. Hopefully this'll work. ;)

vitchy’s picture

Thanks to updated patch. I'm beginning a drupal 8 migration with scald media. Also i applied patch but no media was imported. Anyone could list steps necessary to follow for migrate scald from D7 to D8 ?
Thanks

scsmith’s picture

I'm a bit lost as well. I've tried, unsuccessfully to install the patch on a clean drupal 8.5.3. Without being able to migrate my scald atoms, I'm not able to upgrade to 8 from 7! I'd really like to see an easy way to upgrade!

dan_metille’s picture

As @vitchy and @scsmith, I'm still lost on this.

Patch #16 do not seams to work on upgrade (I have tried from D7 to D8.6 dev), right?

As @vitchy requested 1 month ago, it would be very welcome to get a step by step tutorial on how to migrate Scald from D7 to D8. At least to know if this is really possible to perform at this moment (I mean, somebody succeeded at it ?) and to get some insights about what is required (are any contributed Migrate modules required?) to complete the task.

It is now 1 year that I'm trying to upgrade some sites using Scald to D8, first waiting for 8.4 and media in core to be released, hoping that it will solved the problem, then waiting for 8.5 for a better upgrade integration. And still I'm facing a wall. This is very frustrating.

seanr’s picture

Pretty sure the patch is really only going to work in a custom migration - you'll have to set the mappings and everything. There's no pure upgrade path for this since Scald was a dead end. This patch just makes the source available to migrations.

jcisio’s picture

Status: Needs work » Reviewed & tested by the community

The patch works as expected. Here is an example with this patch, to migrate D7 Scald atom image to D8 media image:

uuid: a3b7c64e-0b09-4817-be44-3dab6f2f8c1e
langcode: fr
status: true
dependencies: {  }
id: upgrade_d7_scald_atom_image
class: null
field_plugin_method: null
cck_plugin_method: null
migration_tags:
- 'Drupal 7'
- Content
migration_group: migrate_drupal_7
label: 'Scald Atoms (image)'
source:
  plugin: d7_scald_atom
  atom_type: image
process:
  name: title
  field_media_image:
    plugin: migration_lookup
    migration: upgrade_d7_file
    source: base_id
  uid:
    plugin: default_value
    default_value: 0
destination:
  plugin: 'entity:media'
  default_bundle: image
migration_dependencies:
  optional:
  - upgrade_d7_file

I don't think it's reasonable to expect an out of the box Scald to Drupal 8 Media migration, given the priority and number of Scald sites and Scald providers, and in most cases, the fields will change.

I'm wondering whether this patch lives on Media Entity 2.x (there is nothing related to Media entity...) or in Scald 8 (module does not exist yet).

jcisio’s picture

In case that #21 is not enough, here is the code snippet to migrate atom reference fields:

...
process:
  field_media_d8:
    plugin: sub_process
    source: field_atom_ref_d7
    process:
      target_id:
        plugin: migration_lookup
        migration: upgrade_d7_scald_atom_image
        source: sid
  ...
dan_metille’s picture

@jcisio you said:

I'm wondering whether this patch lives on Media Entity 2.x (there is nothing related to Media entity...) or in Scald 8 (module does not exist yet).

I'm also wondering that too! Also would like to know how to update that .php file for Media in core.

I'm really wiling to share a proper step by step guide to migrate Scald from D7 to Media in D8, but I need to be able to perform it at least once with basic configuration case.

j4’s picture

Hi @sahaj, any updates on this? Were you able to carry out a migration? Thanks!

sylvainm’s picture

I made a contrib module to handle that: https://www.drupal.org/project/migrate_source_scald

Feel free to contribute :-)