diff --git a/src/Controller/WebserviceController.php b/src/Controller/WebserviceController.php index ba9786e8..5a26f818 100644 --- a/src/Controller/WebserviceController.php +++ b/src/Controller/WebserviceController.php @@ -93,6 +93,7 @@ public function webonyxAction( LongRunningHelper $longRunningHelper ) { $clientname = $request->attributes->getString('clientname'); + $variableValues = null; $configuration = Configuration::getByName($clientname); if (!$configuration || !$configuration->isActive()) { @@ -161,7 +162,6 @@ public function webonyxAction( } $query = $input['query'] ?? ''; - $variableValues = $input['variables'] ?? null; try { $rootValue = []; @@ -178,7 +178,11 @@ public function webonyxAction( $this->eventDispatcher->dispatch($event, ExecutorEvents::PRE_EXECUTE); if ($event->getRequest() instanceof Request) { - $variableValues = $event->getRequest()->request->get('variables', $variableValues); + $variableValues = $event->getRequest()->request->all('variables'); + } + + if (!$variableValues) { + $variableValues = $input['variables'] ?? null; } $configAllowIntrospection = true; diff --git a/src/GraphQL/DataObjectInputProcessor/Table.php b/src/GraphQL/DataObjectInputProcessor/Table.php index 6a4aba2c..041faf07 100644 --- a/src/GraphQL/DataObjectInputProcessor/Table.php +++ b/src/GraphQL/DataObjectInputProcessor/Table.php @@ -46,7 +46,7 @@ public function process($object, $newValue, $args, $context, ResolveInfo $info) $attribute = $this->getAttribute(); $objectBrickParts = Service::parseObjectBrickFieldName($attribute); - if(empty($objectBrickParts)) { + if (empty($objectBrickParts)) { $getter = 'get' . ucfirst($attribute); $currentTable = $object->$getter(); } else { diff --git a/tests/GraphQL/ResolveTest.php b/tests/GraphQL/ResolveTest.php index fe6c7d8d..58e270eb 100644 --- a/tests/GraphQL/ResolveTest.php +++ b/tests/GraphQL/ResolveTest.php @@ -38,7 +38,7 @@ public function testGraphQLTranslationListingResolveListing() $translationListing = new TranslationListing($this->service, new EventDispatcher()); $listRes = $translationListing->resolveListing([], []); - for($i = 0; $i < 4; $i++) { + for ($i = 0; $i < 4; $i++) { $this->assertEquals('translation-k' .$i, $listRes['edges'][$i]['cursor']); $translation = $listRes['edges'][$i]['node']; @@ -53,7 +53,7 @@ public function testGraphQLTranslationListingResolveListingWithDomain() $translationListing = new TranslationListing($this->service, new EventDispatcher()); $listRes = $translationListing->resolveListing([], ['domain' => 'admin']); - for($i = 0; $i < 2; $i++) { + for ($i = 0; $i < 2; $i++) { $this->assertEquals('translation-ka' .$i, $listRes['edges'][$i]['cursor']); $translation = $listRes['edges'][$i]['node']; @@ -85,7 +85,7 @@ public function testGraphQLTranslationListingResolveListingWithKeys() $translationListing = new TranslationListing($this->service, new EventDispatcher()); $listRes = $translationListing->resolveListing([], ['keys' => $keys]); - for($i = 0; $i < 2; $i++) { + for ($i = 0; $i < 2; $i++) { $this->assertEquals('translation-k' .$i + 1, $listRes['edges'][$i]['cursor']); $translation = $listRes['edges'][$i]['node']; @@ -128,7 +128,7 @@ public function testGraphQLTranslationListingResolveListingWithLanguagesAndKeys( $translationListing = new TranslationListing($this->service, new EventDispatcher()); $listRes = $translationListing->resolveListing([], ['languages' => $languages, 'keys' => $keys]); - for($i = 0; $i < 2; $i++) { + for ($i = 0; $i < 2; $i++) { $translation = $listRes['edges'][$i]['node']; $translations = $translation->getTranslations(); @@ -149,10 +149,10 @@ public function testGraphQLResolveTranslationGetter() private function addTranslations(): void { - for($i = 0; $i < 4; $i++) { + for ($i = 0; $i < 4; $i++) { $this->addTranslation('k' . $i); } - for($i = 0; $i < 2; $i++) { + for ($i = 0; $i < 2; $i++) { $this->addTranslation('ka' . $i, 'admin'); $this->addTranslation('ka' . $i, 'admin'); } diff --git a/tests/_support/Helper/Service.php b/tests/_support/Helper/Service.php index d8449e8a..773eeb26 100644 --- a/tests/_support/Helper/Service.php +++ b/tests/_support/Helper/Service.php @@ -33,7 +33,7 @@ public function grabService(string $serviceId) { //TODO change this as soon as Pimcore helper as grabService method and requirement is bumped to pimcore/pimcore:10.4 - if(empty(self::$container)) { + if (empty(self::$container)) { $container = \Pimcore::getContainer(); self::$container = $container->has('test.service_container') ? $container->get('test.service_container') : $container; }