Skip to main content
added 45 characters in body
Source Link

I have a problem with a stale plugin-derivatives cache in a kernel test:

  protected function setUp() {
    parent::setUp();
    $this->installConfig(['my_module', 'my_module_test']);
  }

The my_module_test module installs new entities that should produce derived plugins, but when my test class tries to instantiate these plugins, they are not found.

It works if I explicitly call drupal_flush_all_caches$this->container->get('{my_plugin_manager}')->clearCachedDefinitions() after installConfig(), so it's definitely a stale plugin cache. But I'm worried this problem might happen elsewhere. Is there some way to tag the plugin cache with {my_entity_type}_list so it gets invalidated by new entities? Or is this a static cache somewhere that should be invalidateddo I simply need to invalidate it explicitly whenever I do something that creates new entities?

I have a problem with a stale plugin-derivatives cache in a kernel test:

  protected function setUp() {
    parent::setUp();
    $this->installConfig(['my_module', 'my_module_test']);
  }

The my_module_test module installs new entities that should produce derived plugins, but when my test class tries to instantiate these plugins, they are not found.

It works if I explicitly call drupal_flush_all_caches() after installConfig(), so it's definitely a stale plugin cache. But I'm worried this problem might happen elsewhere. Is there some way to tag the plugin cache with {my_entity_type}_list so it gets invalidated by new entities? Or is this a static cache somewhere that should be invalidated explicitly?

I have a problem with a stale plugin-derivatives cache in a kernel test:

  protected function setUp() {
    parent::setUp();
    $this->installConfig(['my_module', 'my_module_test']);
  }

The my_module_test module installs new entities that should produce derived plugins, but when my test class tries to instantiate these plugins, they are not found.

It works if I explicitly call $this->container->get('{my_plugin_manager}')->clearCachedDefinitions() after installConfig(), so it's definitely a stale plugin cache. But I'm worried this problem might happen elsewhere. Is there some way to tag the plugin cache with {my_entity_type}_list so it gets invalidated by new entities? Or do I simply need to invalidate it explicitly whenever I do something that creates new entities?

Source Link

How to rebuild derived plugins after new entities are installed?

I have a problem with a stale plugin-derivatives cache in a kernel test:

  protected function setUp() {
    parent::setUp();
    $this->installConfig(['my_module', 'my_module_test']);
  }

The my_module_test module installs new entities that should produce derived plugins, but when my test class tries to instantiate these plugins, they are not found.

It works if I explicitly call drupal_flush_all_caches() after installConfig(), so it's definitely a stale plugin cache. But I'm worried this problem might happen elsewhere. Is there some way to tag the plugin cache with {my_entity_type}_list so it gets invalidated by new entities? Or is this a static cache somewhere that should be invalidated explicitly?