Skip to content
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

Fixes missing GraphQL registration #101

Merged
merged 1 commit into from
Sep 10, 2024
Merged
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
16 changes: 16 additions & 0 deletions src/Plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use craft\digitalproducts\fieldlayoutelements\ProductTitleField;
use craft\digitalproducts\fields\Products;
use craft\digitalproducts\gql\interfaces\elements\Product as GqlProductInterface;
use craft\digitalproducts\gql\queries\Product as GqlProductQueries;
use craft\digitalproducts\helpers\ProjectConfigData;
use craft\digitalproducts\models\Settings;
use craft\digitalproducts\plugin\Routes;
Expand All @@ -27,6 +28,7 @@
use craft\events\RebuildConfigEvent;
use craft\events\RegisterComponentTypesEvent;
use craft\events\RegisterGqlSchemaComponentsEvent;
use craft\events\RegisterGqlQueriesEvent;
use craft\events\RegisterGqlTypesEvent;
use craft\events\RegisterUserPermissionsEvent;
use craft\helpers\UrlHelper;
Expand Down Expand Up @@ -95,6 +97,7 @@ public function init(): void
$this->_registerPermissions();
$this->_registerElementTypes();
$this->_registerGqlInterfaces();
$this->_registerGqlQueries();
$this->_registerGqlComponents();
$this->_defineFieldLayoutElements();
$this->_registerGarbageCollection();
Expand Down Expand Up @@ -373,6 +376,19 @@ static function(RegisterGqlTypesEvent $event) {
);
}

/**
* Register the Gql queries
*/
private function _registerGqlQueries(): void
{
Event::on(Gql::class, Gql::EVENT_REGISTER_GQL_QUERIES, static function(RegisterGqlQueriesEvent $event) {
$event->queries = array_merge(
$event->queries,
GqlProductQueries::getQueries(),
);
});
}

/**
* Register the Gql components
*
Expand Down
Loading