You are here

public function MigrateExecutable::__construct in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/migrate/src/MigrateExecutable.php \Drupal\migrate\MigrateExecutable::__construct()
  2. 10 core/modules/migrate/src/MigrateExecutable.php \Drupal\migrate\MigrateExecutable::__construct()

Constructs a MigrateExecutable and verifies and sets the memory limit.

Parameters

\Drupal\migrate\Plugin\MigrationInterface $migration: The migration to run.

\Drupal\migrate\MigrateMessageInterface $message: (optional) The migrate message service.

\Symfony\Contracts\EventDispatcher\EventDispatcherInterface $event_dispatcher: (optional) The event dispatcher.

File

core/modules/migrate/src/MigrateExecutable.php, line 103

Class

MigrateExecutable
Defines a migrate executable class.

Namespace

Drupal\migrate

Code

public function __construct(MigrationInterface $migration, MigrateMessageInterface $message = NULL, EventDispatcherInterface $event_dispatcher = NULL) {
  $this->migration = $migration;
  $this->message = $message ?: new MigrateMessage();
  $this
    ->getIdMap()
    ->setMessage($this->message);
  $this->eventDispatcher = $event_dispatcher;

  // Record the memory limit in bytes
  $limit = trim(ini_get('memory_limit'));
  if ($limit == '-1') {
    $this->memoryLimit = PHP_INT_MAX;
  }
  else {
    $this->memoryLimit = Bytes::toNumber($limit);
  }
}