function ChangeLogger::recordRequestedPackageVersions

Records requested packages.

Parameters

\Drupal\package_manager\Event\PostRequireEvent $event: The event object.

File

core/modules/package_manager/src/EventSubscriber/ChangeLogger.php, line 78

Class

ChangeLogger
Event subscriber to log changes that happen during the stage life cycle.

Namespace

Drupal\package_manager\EventSubscriber

Code

public function recordRequestedPackageVersions(PostRequireEvent $event) : void {
  // There could be multiple 'require' operations, so overlay the requested
  // packages from the current operation onto the requested packages from any
  // previous 'require' operation.
  $requested_packages = array_merge($event->sandboxManager
    ->getMetadata(static::REQUESTED_PACKAGES_KEY) ?? [], $event->getRuntimePackages(), $event->getDevPackages());
  $event->sandboxManager
    ->setMetadata(static::REQUESTED_PACKAGES_KEY, $requested_packages);
  // If we're in direct-write mode, the changes have already been made, so
  // we should log them right away.
  if ($event->sandboxManager
    ->isDirectWrite()) {
    $this->logChanges($event);
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.