Bug Description
When using DataProviders in combination with event listeners (specifically the "NewDataEvent"). The same DataProvider instance is being reused across different contexts with different options, leading to incorrect behavior.
Current Behavior
- A DataProvider instance (trinity_data) is configured with specific options for the main process (ProcessResourceHandler)
- During this process, a "NewDataEvent" is triggered
- The event listener adds additional elements (linked in the current element) to different contexts (name it "resource"). So, temporarily the data provider "trinity_data" is reinitialized in
ResourceValidator::validateResource() with the options of the "resource" context
- After the event listener completes, the subsequent processing of previously queued items continues with the wrong (modified, "resource") DataProvider configuration
public function onNewDataAvailable(NewDataEvent $event): void
{
// Event fired for an element for context "page"
[...]
$contextName = "resource";
$this->dataCollector->addToContextQueue($contextName, $dispatchType, $asset);
[...]
}