Closed bramstroker closed 4 years ago
@bramstroker can you please create a separate issue? thanks!
Also in the WebserviceController a new instance of QueryType is created without using any DI, which is really bad design practice. Better would be to have some factory object, ie QueryTypeFactory which is passed as a dependency to the webservice controler and is responsible for the creation of the query type.
there is a sample about adding mutations, adding a query should work in a similar way.
https://github.com/pimcore/data-hub/blob/master/doc/graphl/AddCustomMutations.md
also added a sample for custom queries:
https://github.com/pimcore/data-hub/blob/master/doc/graphl/AddCustomQuery.md
Tyvm for the fast resolution! Will try to implement next week when I work in the project again. Also had two type errors when trying to get the graphql API working. Will create a PR with the fix.
I was searching for a way to implement a custom GraphQL query which have some extra arguments and a custom resolver, but this seems not possible.
There is some event dispatched
QueryEvents::PRE_BUILD
before all the build in queries are registered, however I cannot alter the$config
there as it is not passed by reference to the event object.Also in the
WebserviceController
a new instance ofQueryType
is created without using any DI, which is really bad design practice. Better would be to have some factory object, ieQueryTypeFactory
which is passed as a dependency to the webservice controler and is responsible for the creation of the query type.Do you have a solution for my use case?