You are here

protected function SourcePluginBase::doCount in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php \Drupal\migrate\Plugin\migrate\source\SourcePluginBase::doCount()
  2. 9 core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php \Drupal\migrate\Plugin\migrate\source\SourcePluginBase::doCount()

Gets the source count checking if the source is countable or using the iterator_count function.

Return value

int

1 call to SourcePluginBase::doCount()
SourcePluginBase::count in core/modules/migrate/src/Plugin/migrate/source/SourcePluginBase.php
4 methods override SourcePluginBase::doCount()
CacheableEmbeddedDataSource::doCount in core/modules/migrate/tests/modules/migrate_cache_counts_test/src/Plugin/migrate/source/CacheableEmbeddedDataSource.php
Gets the source count checking if the source is countable or using the iterator_count function.
ContentEntity::doCount in core/modules/migrate_drupal/src/Plugin/migrate/source/ContentEntity.php
Gets the source count checking if the source is countable or using the iterator_count function.
EmptySource::doCount in core/modules/migrate/src/Plugin/migrate/source/EmptySource.php
Gets the source count checking if the source is countable or using the iterator_count function.
SqlBase::doCount in core/modules/migrate/src/Plugin/migrate/source/SqlBase.php
Gets the source count using countQuery().

File

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

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());
}