public function WorkflowState::count in Workflow 8
Returns the number of entities with this state.
@todo Add $options to select on entity type, etc.
Return value
int Counted number.
File
- src/
Entity/ WorkflowState.php, line 524
Class
- WorkflowState
- Workflow configuration entity to persistently store configuration.
Namespace
Drupal\workflow\EntityCode
public function count() {
$count = 0;
$sid = $this
->id();
foreach (_workflow_info_fields() as $field_info) {
$field_name = $field_info
->getName();
$query = \Drupal::entityQuery($field_info
->getTargetEntityTypeId());
// @see #2285983 for using SQLite on D7.
$count += $query
->condition($field_name, $sid, '=')
->count()
->execute();
}
return $count;
}