protected function SyncHealth::countStatusEntitiesWithFlag in CMS Content Sync 2.1.x
Same name and namespace in other branches
- 8 modules/cms_content_sync_health/src/Controller/SyncHealth.php \Drupal\cms_content_sync_health\Controller\SyncHealth::countStatusEntitiesWithFlag()
- 2.0.x modules/cms_content_sync_health/src/Controller/SyncHealth.php \Drupal\cms_content_sync_health\Controller\SyncHealth::countStatusEntitiesWithFlag()
Count status entities with the given flag.
Parameters
int $flag: See EntityStatus::FLAG_*.
array $details: Search the 'data' column to contain the given $value and save it in the result array at $key.
Return value
array The counts, always having 'total'=>... and optionally the counts given by $details.
3 calls to SyncHealth::countStatusEntitiesWithFlag()
- SyncHealth::overview in modules/
cms_content_sync_health/ src/ Controller/ SyncHealth.php - Render the overview page.
- SyncHealth::pulling in modules/
cms_content_sync_health/ src/ Controller/ SyncHealth.php - Render the overview page.
- SyncHealth::pushing in modules/
cms_content_sync_health/ src/ Controller/ SyncHealth.php - Render the overview page.
File
- modules/
cms_content_sync_health/ src/ Controller/ SyncHealth.php, line 159
Class
- SyncHealth
- Provides a listing of Flow.
Namespace
Drupal\cms_content_sync_health\ControllerCode
protected function countStatusEntitiesWithFlag($flag, $details = []) {
$result['total'] = $this->database
->select('cms_content_sync_entity_status')
->where('flags&:flag=:flag', [
':flag' => $flag,
])
->countQuery()
->execute()
->fetchField();
if ($result['total']) {
foreach ($details as $name => $search) {
$search = '%' . $this->database
->escapeLike($search) . '%';
$result[$name] = $this->database
->select('cms_content_sync_entity_status')
->where('flags&:flag=:flag', [
':flag' => $flag,
])
->condition('data', $search, 'LIKE')
->countQuery()
->execute()
->fetchField();
}
}
return $result;
}