public function LinkExtractorBatch::getTotalEntitiesToProcess in Link checker 8
Gets total number of entities to process.
Return value
int Total number of entities.
1 call to LinkExtractorBatch::getTotalEntitiesToProcess()
- LinkExtractorBatch::batchProcessEntities in src/
LinkExtractorBatch.php - Process part of entities within a batch operation.
File
- src/
LinkExtractorBatch.php, line 140
Class
- LinkExtractorBatch
- Helper service to handle extraction index.
Namespace
Drupal\linkcheckerCode
public function getTotalEntitiesToProcess() {
$entityTypes = $this
->getEntityTypesToProcess();
$total = 0;
foreach ($entityTypes as $entityTypeData) {
/** @var \Drupal\Core\Entity\EntityTypeInterface $entityType */
$entityType = $entityTypeData['entity_type'];
$bundle = $entityTypeData['bundle'];
// We don`t use $this->getQuery() cause we do not need left join
// on linkchecker_index table.
$query = $this->database
->select($entityType
->getBaseTable(), 'base');
$query
->fields('base', [
$entityType
->getKey('id'),
]);
if (!empty($bundle)) {
$query
->condition('base.' . $entityType
->getKey('bundle'), $bundle);
}
$query = $query
->countQuery();
$total += $query
->execute()
->fetchField();
}
return $total;
}