You are here

public function SqlBase::count in Drupal 8

Gets the source count.

Return a count of available source records, from the cache if appropriate. Returns -1 if the source is not countable.

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

6 methods override SqlBase::count()
EntityTranslationSettings::count in core/modules/content_translation/src/Plugin/migrate/source/d7/EntityTranslationSettings.php
Gets the source count.
FieldInstance::count in core/modules/field/src/Plugin/migrate/source/d7/FieldInstance.php
Gets the source count.
Variable::count in core/modules/migrate_drupal/src/Plugin/migrate/source/Variable.php
Gets the source count.
VariableTranslation::count in core/modules/migrate_drupal/src/Plugin/migrate/source/d6/VariableTranslation.php
Gets the source count.
VariableTranslation::count in core/modules/migrate_drupal/src/Plugin/migrate/source/d7/VariableTranslation.php
Gets the source count.

... See full list

File

core/modules/migrate/src/Plugin/migrate/source/SqlBase.php, line 388

Class

SqlBase
Sources whose data may be fetched via a database connection.

Namespace

Drupal\migrate\Plugin\migrate\source

Code

public function count($refresh = FALSE) {
  return (int) $this
    ->query()
    ->countQuery()
    ->execute()
    ->fetchField();
}