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.
Comment | File | Size | Author |
---|---|---|---|
#2 | entity_import-count_functions-3093681-2.patch | 2.97 KB | justin2pin |
Comments
Comment #2
justin2pin CreditAttribution: justin2pin at Aten Design Group commentedPatch attached.
Comment #3
droath CreditAttribution: droath at Aten Design Group commentedThank 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.
Comment #5
droath CreditAttribution: droath at Aten Design Group commentedComment #6
droath CreditAttribution: droath at Aten Design Group commented