diff --git a/src/Event/GraphQL/ListingEvents.php b/src/Event/GraphQL/ListingEvents.php index 89b718cb..699969e0 100644 --- a/src/Event/GraphQL/ListingEvents.php +++ b/src/Event/GraphQL/ListingEvents.php @@ -14,6 +14,13 @@ final class ListingEvents { + /** + * @Event("Symfony\Component\EventDispatcher\GenericEvent") + * + * @var string + */ + const PRE_BUILD = 'pimcore.datahub.graphql.listing.preBuild'; + /** * @Event("Pimcore\Bundle\DataHubBundle\Event\GraphQL\Model\ListingEvent") * diff --git a/src/GraphQL/Resolver/QueryType.php b/src/GraphQL/Resolver/QueryType.php index db03ae87..d45b8304 100644 --- a/src/GraphQL/Resolver/QueryType.php +++ b/src/GraphQL/Resolver/QueryType.php @@ -370,6 +370,12 @@ public function resolveListing($value = null, $args = [], $context = [], ?Resolv $this->getGraphQlService()->getLocaleService()->setLocale($args['defaultLanguage']); } + $event = new GenericEvent( + arguments: $args, + ); + + $this->eventDispatcher->dispatch($event, ListingEvents::PRE_BUILD); + $modelFactory = $this->getGraphQlService()->getModelFactory(); $listClass = 'Pimcore\\Model\\DataObject\\' . ucfirst($this->class->getName()) . '\\Listing'; /** @var Listing\Concrete $objectList */