function ChangeLogger::recordInstalledPackages

Records packages installed in the project root.

We need to do this before the staging environment has been created, so that we have a complete picture of which requested packages are merely being updated, and which are being newly added. Once the staging environment has been created, the installed packages won't change -- if they do, a validation error will be raised.

Parameters

\Drupal\package_manager\Event\PreCreateEvent $event: The event being handled.

See also

\Drupal\package_manager\Validator\LockFileValidator

File

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

Class

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

Namespace

Drupal\package_manager\EventSubscriber

Code

public function recordInstalledPackages(PreCreateEvent $event) : void {
    $packages = $this->composerInspector
        ->getInstalledPackagesList($this->pathLocator
        ->getProjectRoot());
    $event->stage
        ->setMetadata(static::INSTALLED_PACKAGES_KEY, $packages);
}

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