UpdateCompilerPass example

/** * {@inheritdoc} */
  public function register(ContainerBuilder $container) {
    // Decorate the cache factory in order to use     // \Drupal\Core\Update\UpdateBackend while running updates.     $container
      ->register('update.cache_factory', UpdateCacheBackendFactory::class)
      ->setDecoratedService('cache_factory')
      ->addArgument(new Reference('update.cache_factory.inner'));

    $container->addCompilerPass(new UpdateCompilerPass(), PassConfig::TYPE_REMOVE, 128);
  }

  /** * {@inheritdoc} */
  public function alter(ContainerBuilder $container) {
    // The alias-based processor requires the path_alias entity schema to be     // installed, so we prevent it from being registered to the path processor     // manager. We do this by removing the tags that the compiler pass looks     // for. This means that the URL generator can safely be used during the     // database update process.
Home | Imprint | This part of the site doesn't use cookies.