Skip to main content
Version: 2026.2

Custom Report Data Source Events

When Pimcore Studio builds the report configuration form, Statistics Explorer assembles the available data sources, their fields and the per-field settings. Three pre-response events fire during that assembly and let a listener enrich or adjust each item before it is sent to Pimcore Studio.

warning

The endpoints that trigger these events are marked @internal and change without deprecation. Do not call them from your own code. The events themselves are stable extension points. The generated API reference is served at /pimcore-studio/api/docs.

All three events extend Pimcore\Bundle\StudioBackendBundle\Event\AbstractPreResponseEvent and are dispatched under the event name in their EVENT_NAME constant. Besides the getters listed below, every event exposes addAdditionalAttribute(), getAdditionalAttribute(), hasAdditionalAttribute() and removeAdditionalAttribute(), which write to the additionalAttributes of the response object.

DataSourceEvent

  • Class: Pimcore\Bundle\StatisticsExplorerBundle\Events\CustomReports\PreResponse\DataSource\DataSourceEvent
  • Event name: pre_response.data_source
  • Fires once per data source when the list of selectable data sources is built.
  • getDataSource(): DataSource returns the hydrated data source with getValue(), getLabel() and getType().

FieldsEvent

  • Class: Pimcore\Bundle\StatisticsExplorerBundle\Events\CustomReports\PreResponse\DataSource\Fields\FieldsEvent
  • Event name: pre_response.data_source.fields
  • Fires once per request when the fields of a single data source are resolved, after the blocklists have been applied.
  • getDataSourceFields(): Fields returns the field collection with getData() and getOperators().

FieldDefinitionEvent

  • Class: Pimcore\Bundle\StatisticsExplorerBundle\Events\CustomReports\PreResponse\DataSource\Fields\FieldDefinitionEvent
  • Event name: pre_response.data_source.fields.field_definition
  • Fires once per field definition when the field settings for the selected aggregations and columns are resolved.
  • getFieldDefinition(): FieldDefinition returns the definition with getLabel(), getName(), getTypeGroup() and getFields().

Example Listener

namespace App\EventListener;

use Pimcore\Bundle\StatisticsExplorerBundle\Events\CustomReports\PreResponse\DataSource\DataSourceEvent;
use Symfony\Component\EventDispatcher\Attribute\AsEventListener;

#[AsEventListener(event: DataSourceEvent::EVENT_NAME)]
final class DataSourceListener
{
public function __invoke(DataSourceEvent $event): void
{
$event->addAdditionalAttribute('group', $event->getDataSource()->getType());
}
}