Problem/Motivation

Currently the count() method in implementations of EntityImportSourceInterface returns the count of the limited iterator rather than the entire source count. Example: if your CSV has 1,000 records, and your limit iterator is configured to process 100 at a time, the count() method returns 100. While things work as expected in the entity import interface, this produces unexpected results in other contexts. For example, when using migrate tools the drush migrate status command will report that the total count of your source is only 100, while the expected number would be 1000 for the example above.

Proposed resolution

Provide two specific count methods in EntityImportSourceInterface; one that returns the limited count, the other that returns the total count.

Remaining tasks

Review approach and provide patch.

API changes

Change the way limitIteratorCount() works. limitIteratorCount() returns the limited count; a new method, limitIteratorMaxCount(), returns the max count.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

justin2pin created an issue. See original summary.

justin2pin’s picture

Status: Needs work » Needs review
FileSize
2.97 KB

Patch attached.

droath’s picture

Status: Needs review » Reviewed & tested by the community

Thank you! This issue makes sense. The source count() method will be used to return the max number of items in the iterator, and the getLimitIteratorCount() will return only the count that's relevant to the iterator.

  • droath committed 1edd745 on 8.x-1.x authored by justin2pin
    Issue #3093681 by justin2pin, droath: Using count() to return the count...
droath’s picture

Status: Reviewed & tested by the community » Fixed
droath’s picture

Status: Fixed » Closed (fixed)