Problem/Motivation

In \Drupal\migrate\Plugin\migrate\source\SourcePluginBase::initializeIterator() the docblock states:

  /**
   * Initializes the iterator with the source data.
   *
   * @return array
   *   An array of the data for this source.
   */
  abstract protected function initializeIterator();

However this is incompatible with the iterator_count($this->initializeIterator()) that happens some lines below in the same file.

Proposed resolution

Change the docblock to document that the method should return an istance of \Traversable (either \Iterator or \IteratorAggregate).

Remaining tasks

User interface changes

API changes

Data model changes

Comments

marcoscano created an issue. See original summary.

marcoscano’s picture

Assigned: marcoscano » Unassigned
Issue summary: View changes
Status: Active » Needs review
StatusFileSize
new738 bytes

Status: Needs review » Needs work

The last submitted patch, 2: 2931420-2.patch, failed testing. View results

marcoscano’s picture

Status: Needs work » Needs review
chiranjeeb2410’s picture

StatusFileSize
new733 bytes

@marcoscano,

Tweaked the @return statement doc a bit.

Status: Needs review » Needs work

The last submitted patch, 5: 2931420-5.patch, failed testing. View results

neclimdul’s picture

#2918837: SqlBase throws fatal error when extended directly already changed the type but the docs might be able to be improved still.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

harsha012’s picture

Status: Needs work » Needs review
StatusFileSize
new671 bytes
heddn’s picture

Status: Needs review » Needs work

It returns an iterator, not an array. See #2918837-22: SqlBase throws fatal error when extended directly.

Perhaps: Returns an iteratable object of data for this source.

harsha012’s picture

Status: Needs work » Needs review
StatusFileSize
new683 bytes

Fixed as per #10

chiranjeeb2410’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new687 bytes

@marcoscano,

Attached interdiff for patches #9 and #11. Doc change suggested by @heddn, in comment #10, seems to be apt. It should in fact return an iterator object.
RTBC good to go!

heddn’s picture

+1

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 11: 2931420-11.patch, failed testing. View results

neclimdul’s picture

Status: Needs work » Reviewed & tested by the community

unrelated.

  • catch committed 40d6328 on 8.6.x
    Issue #2931420 by harsha012, chiranjeeb2410, marcoscano, heddn: Fix...
catch’s picture

Version: 8.6.x-dev » 8.5.x-dev
Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.6.x and cherry-picked to 8.5.x. Thanks!

  • catch committed d66fb14 on 8.5.x
    Issue #2931420 by harsha012, chiranjeeb2410, marcoscano, heddn: Fix...

Status: Fixed » Closed (fixed)

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