Currently, any class extending MigrateContentParser() has no knowledge of the item id of the data being parsed--only its content. For debugging purposes, it would be helpful to know the source item id. This can be accomplished by passing it to the setContent() method. Patch forthcoming.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

grasmash’s picture

Status: Active » Needs review
FileSize
1.74 KB
mikeryan’s picture

Status: Needs review » Needs work
Issue tags: +Migrate 2.9
  1. +++ b/plugins/sources/files.inc
    @@ -25,8 +25,9 @@ define('MIGRATE_CHUNK_SEPARATOR', '-?MIGRATECHUNK?-');
    +  public function setContent($content, $item_id) {
    

    Let's default $item_id to NULL, for the sake of any existing implementors out there that will break on the required argument.

  2. +++ b/plugins/sources/files.inc
    @@ -25,8 +25,9 @@ define('MIGRATE_CHUNK_SEPARATOR', '-?MIGRATECHUNK?-');
    +    $this->item_id = $item_id;
    

    Please declare the item_id member variable. Extra credit for filling in a missing docblock or three!

joachim’s picture

Status: Needs work » Needs review
FileSize
3.63 KB

I think it would be clearer to pass as the ID the bit that goes before the MIGRATE_CHUNK_SEPARATOR in the overall ID. That way everything is working with the same kinds of IDs. The parser shouldn't need to reconstitute a file URI, as it has the file contents to work with.

Docblocks as requested :)

mikeryan’s picture

Status: Needs review » Fixed

Committed, thanks!

  • mikeryan committed 3cb8f4c on 7.x-2.x authored by grasmash
    Issue #2505683 by grasmash, joachim: Pass item ID to...

Status: Fixed » Closed (fixed)

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