You are here

public static function EntityUpdatePrint::displaySummery in Entity Update 8

Same name and namespace in other branches
  1. 2.0.x src/EntityUpdatePrint.php \Drupal\entity_update\EntityUpdatePrint::displaySummery()

Show the summary of an entity type.

Parameters

string $type: The entity type id.

1 call to EntityUpdatePrint::displaySummery()
drush_entity_update_entity_check in ./entity_update.drush.inc
Call back function of entity-check.

File

src/EntityUpdatePrint.php, line 37

Class

EntityUpdatePrint
EntityCheck CLI Print class.

Namespace

Drupal\entity_update

Code

public static function displaySummery($type) {
  try {
    $entity_type = \Drupal::entityTypeManager()
      ->getDefinition($type);
    $query = \Drupal::entityQuery($type);
    $ids = $query
      ->execute();
    drush_print("Entity type  : " . $type);
    drush_print("Label        : " . $entity_type
      ->getLabel());
    drush_print("Group        : " . $entity_type
      ->getGroupLabel());
    drush_print("Class        : " . $entity_type
      ->getClass());
    drush_print("Nb of Items  : " . count($ids));
    drush_print("Base table   : " . $entity_type
      ->getBaseTable());
    drush_print("Data table   : " . $entity_type
      ->getDataTable());
    drush_print("Bundle Label : " . $entity_type
      ->getBundleLabel());
    drush_print("Bundle Of    : " . $entity_type
      ->getBundleOf());
    drush_print("Bundle Type  : " . $entity_type
      ->getBundleEntityType());
    drush_print("Admin perm   : " . $entity_type
      ->getAdminPermission());
  } catch (\Exception $ex) {
    drush_log($ex
      ->getMessage(), 'error');
  }
}