You are here

private function MergeConfirmForm::getAuthoredReferencesStatistic in Bibliography & Citation 8

Same name and namespace in other branches
  1. 2.0.x modules/bibcite_entity/src/Form/MergeConfirmForm.php \Drupal\bibcite_entity\Form\MergeConfirmForm::getAuthoredReferencesStatistic()

Find references and get statistic data.

Return value

array Statistic data with first 10 objects and count of another references.

1 call to MergeConfirmForm::getAuthoredReferencesStatistic()
MergeConfirmForm::buildForm in modules/bibcite_entity/src/Form/MergeConfirmForm.php
Form constructor.

File

modules/bibcite_entity/src/Form/MergeConfirmForm.php, line 150

Class

MergeConfirmForm
Confirm merge of bibliographic entities.

Namespace

Drupal\bibcite_entity\Form

Code

private function getAuthoredReferencesStatistic() {
  $storage = \Drupal::entityTypeManager()
    ->getStorage('bibcite_reference');
  $range = 10;
  $query = $storage
    ->getQuery();
  $query
    ->condition($this->fieldName, $this->source
    ->id());
  $query
    ->range(0, $range);
  $entities = $storage
    ->loadMultiple($query
    ->execute());
  $count = $query
    ->range()
    ->count()
    ->execute();
  return [
    'entities' => $entities,
    'count' => $count > $range ? $count - $range : 0,
  ];
}