function Variable::doCount

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

Gets the source count using countQuery().

Overrides SqlBase::doCount

1 method overrides Variable::doCount()
SearchPage::doCount in core/modules/search/src/Plugin/migrate/source/d7/SearchPage.php
Gets the source count using countQuery().

File

core/modules/migrate_drupal/src/Plugin/migrate/source/Variable.php, line 138

Class

Variable
Drupal 6/7 variable source from database.

Namespace

Drupal\migrate_drupal\Plugin\migrate\source

Code

protected function doCount() {
  if (empty($this->variablesNoRowIfMissing)) {
    return 1;
  }
  $variable_names = array_keys($this->query()
    ->execute()
    ->fetchAllAssoc('name'));
  if (!empty(array_diff($this->variablesNoRowIfMissing, $variable_names))) {
    return 0;
  }
  return 1;
}

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