You are here

public static function EntityUpdatePrint::displaySummery in Entity Update 2.0.x

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

Show the summary of an entity type.

Parameters

string $type: The entity type id.

2 calls to EntityUpdatePrint::displaySummery()
drush_entity_update_entity_check in drush/entity_update.drush8.inc
Call back function of entity-check.
EntityUpdatesCommands::entityCheck in src/Commands/EntityUpdatesCommands.php
Check entity schema updates.

File

src/EntityUpdatePrint.php, line 64

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();
    self::echoPrint("Entity type  : " . $type);
    self::echoPrint("Label        : " . $entity_type
      ->getLabel());
    self::echoPrint("Group        : " . $entity_type
      ->getGroupLabel());
    self::echoPrint("Class        : " . $entity_type
      ->getClass());
    self::echoPrint("Nb of Items  : " . count($ids));
    self::echoPrint("Base table   : " . $entity_type
      ->getBaseTable());
    self::echoPrint("Data table   : " . $entity_type
      ->getDataTable());
    self::echoPrint("Bundle Label : " . $entity_type
      ->getBundleLabel());
    self::echoPrint("Bundle Of    : " . $entity_type
      ->getBundleOf());
    self::echoPrint("Bundle Type  : " . $entity_type
      ->getBundleEntityType());
    self::echoPrint("Admin perm   : " . $entity_type
      ->getAdminPermission());
  } catch (\Exception $ex) {
    self::echoPrint($ex
      ->getMessage());
  }
}