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

[Task]: Follow up to Replace Request::get with explicit input sources #877

Merged
merged 4 commits into from
Sep 4, 2024
Merged
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
8 changes: 6 additions & 2 deletions src/Controller/WebserviceController.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ public function webonyxAction(
LongRunningHelper $longRunningHelper
) {
$clientname = $request->attributes->getString('clientname');
$variableValues = null;

$configuration = Configuration::getByName($clientname);
if (!$configuration || !$configuration->isActive()) {
Expand Down Expand Up @@ -161,7 +162,6 @@ public function webonyxAction(
}

$query = $input['query'] ?? '';
$variableValues = $input['variables'] ?? null;

try {
$rootValue = [];
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/GraphQL/DataObjectInputProcessor/Table.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
12 changes: 6 additions & 6 deletions tests/GraphQL/ResolveTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'];
Expand All @@ -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'];
Expand Down Expand Up @@ -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'];
Expand Down Expand Up @@ -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();

Expand All @@ -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');
}
Expand Down
2 changes: 1 addition & 1 deletion tests/_support/Helper/Service.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
Loading