function SourcePluginBase::doCount

Same name and namespace in other branches
  1. 11.x core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php \Drupal\migrate\Plugin\migrate\source\SourcePluginBase::doCount()
  2. 10 core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php \Drupal\migrate\Plugin\migrate\source\SourcePluginBase::doCount()
  3. 8.9.x core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php \Drupal\migrate\Plugin\migrate\source\SourcePluginBase::doCount()

Gets the source count.

Checks if the source is countable or using the iterator_count function.

Return value

int

1 method overrides SourcePluginBase::doCount()
CacheableEmbeddedDataSource::doCount in core/modules/migrate/tests/modules/migrate_cache_counts_test/src/Plugin/migrate/source/CacheableEmbeddedDataSource.php
Gets the source count.

File

core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php, line 537

Class

SourcePluginBase
The base class for source plugins.

Namespace

Drupal\migrate\Plugin\migrate\source

Code

protected function doCount() {
  $iterator = $this->getIterator();
  return $iterator instanceof \Countable ? $iterator->count() : iterator_count($this->initializeIterator());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.