function EmbeddedDataSource::count

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

Gets the source count.

Return a count of available source records, from the cache if appropriate. Returns MigrateSourceInterface::NOT_COUNTABLE if the source is not countable.

Attributes

#[\ReturnTypeWillChange]

Parameters

bool $refresh: (optional) Whether or not to refresh the count. Defaults to FALSE. Not all implementations support the reset flag. In such instances this parameter is ignored and the result of calling the method will always be up to date.

Return value

int The count.

Overrides SourcePluginBase::count

2 calls to EmbeddedDataSource::count()
CacheableEmbeddedDataSource::doCount in core/modules/migrate/tests/modules/migrate_cache_counts_test/src/Plugin/migrate/source/CacheableEmbeddedDataSource.php
Gets the source count.
EmbeddedDataSource::fields in core/modules/migrate/src/Plugin/migrate/source/EmbeddedDataSource.php
Returns available fields on the source.
1 method overrides EmbeddedDataSource::count()
CacheableEmbeddedDataSource::count 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/EmbeddedDataSource.php, line 116

Class

EmbeddedDataSource
Allows source data to be defined in the configuration of the source plugin.

Namespace

Drupal\migrate\Plugin\migrate\source

Code

public function count($refresh = FALSE) {
    // We do not want this source plugin to have a cacheable count.
    // @see \Drupal\migrate_cache_counts_test\Plugin\migrate\source\CacheableEmbeddedDataSource
    return count($this->dataRows);
}

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