Skip to content

Added prebuild event for extending possibilities to hook into graphql queries #982

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/Event/GraphQL/ListingEvents.php
Original file line number Diff line number Diff line change
Expand Up @@ -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")
*
Expand Down
6 changes: 6 additions & 0 deletions src/GraphQL/Resolver/QueryType.php
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,12 @@
$this->getGraphQlService()->getLocaleService()->setLocale($args['defaultLanguage']);
}

$event = new GenericEvent(

Check failure on line 373 in src/GraphQL/Resolver/QueryType.php

View workflow job for this annotation

GitHub Actions / static-analysis (8.4, highest, false, true) / Static analysis with phpstan

Instantiated class Pimcore\Bundle\DataHubBundle\GraphQL\Resolver\GenericEvent not found.

Check failure on line 373 in src/GraphQL/Resolver/QueryType.php

View workflow job for this annotation

GitHub Actions / static-analysis (8.3, lowest, false, true) / Static analysis with phpstan

Instantiated class Pimcore\Bundle\DataHubBundle\GraphQL\Resolver\GenericEvent not found.

Check failure on line 373 in src/GraphQL/Resolver/QueryType.php

View workflow job for this annotation

GitHub Actions / static-analysis (8.4, highest, 12.x-dev as 12.99.9, true, true) / Static analysis with phpstan

Instantiated class Pimcore\Bundle\DataHubBundle\GraphQL\Resolver\GenericEvent not found.
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 */
Expand Down
Loading