getOperationType example



  /** * {@inheritdoc} */
  public function event(PackageEvent $event) {
    $operation = $event->getOperation();
    // Determine the package. Later, in evaluateNewPackages(), we will report     // which of the newly-installed packages have scaffold operations, and     // whether or not they are allowed to scaffold by the allowed-packages     // option in the root-level composer.json file.     $package = $operation->getOperationType() === 'update' ? $operation->getTargetPackage() : $operation->getPackage();
    if (ScaffoldOptions::hasOptions($package->getExtra())) {
      $this->newPackages[$package->getName()] = $package;
    }
  }

  /** * Gets all packages that are allowed in the top-level composer.json. * * We will implicitly allow the projects 'drupal/legacy-scaffold-assets' * and 'drupal/core' to scaffold files, if they are present. Any other * project must be explicitly whitelisted in the top-level composer.json * file in order to be allowed to override scaffold files. * * @return array * An array of allowed Composer package names. */
Home | Imprint | This part of the site doesn't use cookies.