You are here

public function EntityUpdatesCommands::entityCheck in Entity Update 2.0.x

Check entity schema updates.

@command entity-check @aliases upec

@option types Show entities to update @option list Show entities list @option length Number of entities to show @option start Start from

@usage drush upe --show

@usage drush upec node Show The entity summery. @usage drush upec --types Show all entity types list. @usage drush upec block --types Show all entity types list contains "block" @usage drush upec node --list Show 10 entities. @usage drush upec node --list --length=0 Show all entities. @usage drush upec node --list --start=2 --length=3 Show 3 entities from 2.

@bootstrap full

Parameters

string $type: The entity type ID to update.

array $options: Array of options.

Throws

\Exception

File

src/Commands/EntityUpdatesCommands.php, line 244

Class

EntityUpdatesCommands
Drush9 commands definitions.

Namespace

Drupal\entity_update\Commands

Code

public function entityCheck($type = NULL, array $options = [
  'start' => 0,
  'length' => 0,
]) {

  // Options which hasn't need to have entity type.
  if (!empty($options['types'])) {

    // Display entity types list.
    EntityCheck::getEntityTypesList($type);
    return;
  }

  // Options need to have an entity type.
  if ($type) {
    if (!empty($options['list'])) {

      // Display entity types list.
      $length = !empty($options['length']) ?: 10;
      EntityCheck::getEntityList($type, !empty($options['start']), $length);
      return;
    }

    // Default action. Show the summary of the entity type.
    EntityUpdatePrint::displaySummery($type);
    return;
  }
  $this
    ->say('No option specified, please type "drush help upec" for help or refer to the documentation.');
  $this
    ->say('No option specified, please type "drush help upec" for help or refer to the documentation.');
}