From 1b4a3bc7bcedc3ea4e27b4d02f1fd66609b6e445 Mon Sep 17 00:00:00 2001 From: Rik <5927342+rikwillems@users.noreply.github.com> Date: Wed, 5 May 2021 21:14:07 +0200 Subject: [PATCH 01/14] Exception are not translated to store scope #31351 --- app/code/Magento/GraphQl/Controller/GraphQl.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/app/code/Magento/GraphQl/Controller/GraphQl.php b/app/code/Magento/GraphQl/Controller/GraphQl.php index 34dbeaa2ed0a2..37f0eeabc0f56 100644 --- a/app/code/Magento/GraphQl/Controller/GraphQl.php +++ b/app/code/Magento/GraphQl/Controller/GraphQl.php @@ -7,6 +7,8 @@ namespace Magento\GraphQl\Controller; +use Magento\Framework\App\Area; +use Magento\Framework\App\AreaList; use Magento\Framework\App\FrontControllerInterface; use Magento\Framework\App\Request\Http; use Magento\Framework\App\RequestInterface; @@ -88,6 +90,11 @@ class GraphQl implements FrontControllerInterface * @var ContextFactoryInterface */ private $contextFactory; + + /** + * @var AreaList $areaList + */ + private $appState; /** * @param Response $response @@ -114,7 +121,8 @@ public function __construct( QueryFields $queryFields, JsonFactory $jsonFactory = null, HttpResponse $httpResponse = null, - ContextFactoryInterface $contextFactory = null + ContextFactoryInterface $contextFactory = null, + AreaList $areaList ) { $this->response = $response; $this->schemaGenerator = $schemaGenerator; @@ -127,6 +135,7 @@ public function __construct( $this->jsonFactory = $jsonFactory ?: ObjectManager::getInstance()->get(JsonFactory::class); $this->httpResponse = $httpResponse ?: ObjectManager::getInstance()->get(HttpResponse::class); $this->contextFactory = $contextFactory ?: ObjectManager::getInstance()->get(ContextFactoryInterface::class); + $this->areaList = $areaList; } /** @@ -138,6 +147,8 @@ public function __construct( */ public function dispatch(RequestInterface $request) : ResponseInterface { + $this->areaList->getArea(Area::AREA_GRAPHQL)->load(Area::PART_TRANSLATE); + $statusCode = 200; $jsonResult = $this->jsonFactory->create(); try { From f096a714c4c2d696f3871d9b6f42091ce4b8d601 Mon Sep 17 00:00:00 2001 From: Rik <5927342+rikwillems@users.noreply.github.com> Date: Mon, 10 May 2021 21:06:52 +0200 Subject: [PATCH 02/14] Update per Backward Compatibility Policy --- app/code/Magento/GraphQl/Controller/GraphQl.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/code/Magento/GraphQl/Controller/GraphQl.php b/app/code/Magento/GraphQl/Controller/GraphQl.php index 37f0eeabc0f56..ef7994cb7412a 100644 --- a/app/code/Magento/GraphQl/Controller/GraphQl.php +++ b/app/code/Magento/GraphQl/Controller/GraphQl.php @@ -122,7 +122,7 @@ public function __construct( JsonFactory $jsonFactory = null, HttpResponse $httpResponse = null, ContextFactoryInterface $contextFactory = null, - AreaList $areaList + AreaList $areaList = null ) { $this->response = $response; $this->schemaGenerator = $schemaGenerator; @@ -135,7 +135,7 @@ public function __construct( $this->jsonFactory = $jsonFactory ?: ObjectManager::getInstance()->get(JsonFactory::class); $this->httpResponse = $httpResponse ?: ObjectManager::getInstance()->get(HttpResponse::class); $this->contextFactory = $contextFactory ?: ObjectManager::getInstance()->get(ContextFactoryInterface::class); - $this->areaList = $areaList; + $this->areaList = $areaList ?: ObjectManager::getInstance()->get(AreaList::class);; } /** From f05bec201be90dc69fe0c756f35b442201b0cf2e Mon Sep 17 00:00:00 2001 From: Rik <5927342+rikwillems@users.noreply.github.com> Date: Mon, 10 May 2021 22:25:30 +0200 Subject: [PATCH 03/14] Fix double semicolon --- app/code/Magento/GraphQl/Controller/GraphQl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/GraphQl/Controller/GraphQl.php b/app/code/Magento/GraphQl/Controller/GraphQl.php index ef7994cb7412a..2b4c1ac7c530c 100644 --- a/app/code/Magento/GraphQl/Controller/GraphQl.php +++ b/app/code/Magento/GraphQl/Controller/GraphQl.php @@ -135,7 +135,7 @@ public function __construct( $this->jsonFactory = $jsonFactory ?: ObjectManager::getInstance()->get(JsonFactory::class); $this->httpResponse = $httpResponse ?: ObjectManager::getInstance()->get(HttpResponse::class); $this->contextFactory = $contextFactory ?: ObjectManager::getInstance()->get(ContextFactoryInterface::class); - $this->areaList = $areaList ?: ObjectManager::getInstance()->get(AreaList::class);; + $this->areaList = $areaList ?: ObjectManager::getInstance()->get(AreaList::class); } /** From e7c2ee99232246f2c3586cdde57448fa697747ee Mon Sep 17 00:00:00 2001 From: Rik <5927342+rikwillems@users.noreply.github.com> Date: Fri, 14 May 2021 15:06:01 +0200 Subject: [PATCH 04/14] Fix typehint --- app/code/Magento/GraphQl/Controller/GraphQl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/GraphQl/Controller/GraphQl.php b/app/code/Magento/GraphQl/Controller/GraphQl.php index 2b4c1ac7c530c..608d7c63d5a3c 100644 --- a/app/code/Magento/GraphQl/Controller/GraphQl.php +++ b/app/code/Magento/GraphQl/Controller/GraphQl.php @@ -94,7 +94,7 @@ class GraphQl implements FrontControllerInterface /** * @var AreaList $areaList */ - private $appState; + private $areaList; /** * @param Response $response From ab5d921d73714d7370a1269bc23164a89df6173c Mon Sep 17 00:00:00 2001 From: Shikha Mishra Date: Wed, 18 Aug 2021 21:19:11 +0530 Subject: [PATCH 05/14] Added Valid store check to avoid Fatal errors --- .../HttpHeaderProcessor/StoreProcessor.php | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/app/code/Magento/StoreGraphQl/Controller/HttpHeaderProcessor/StoreProcessor.php b/app/code/Magento/StoreGraphQl/Controller/HttpHeaderProcessor/StoreProcessor.php index 7999a96917cde..be205e53b7f61 100644 --- a/app/code/Magento/StoreGraphQl/Controller/HttpHeaderProcessor/StoreProcessor.php +++ b/app/code/Magento/StoreGraphQl/Controller/HttpHeaderProcessor/StoreProcessor.php @@ -55,12 +55,14 @@ public function __construct( * @param string $headerValue * @return void */ - public function processHeaderValue(string $headerValue) : void + public function processHeaderValue(string $headerValue): void { if (!empty($headerValue)) { $storeCode = ltrim(rtrim($headerValue)); - $this->storeManager->setCurrentStore($storeCode); - $this->updateContext($storeCode); + if ($this->isStoreValid($storeCode)) { + $this->storeManager->setCurrentStore($storeCode); + $this->updateContext($storeCode); + } } elseif (!$this->isAlreadySet()) { $storeCode = $this->storeCookieManager->getStoreCodeFromCookie() ?: $this->storeManager->getDefaultStoreView()->getCode(); @@ -95,4 +97,19 @@ private function isAlreadySet(): bool return $this->httpContext->getValue($storeKey) !== null; } + + /** + * Check if provided store code exist + * + * @param string $storeCode + * @return bool + */ + private function isStoreValid(string $storeCode): bool + { + $stores = $this->storeManager->getStores(true, true); + if (isset($stores[$storeCode])) { + return true; + } + return false; + } } From 511ab01cb30d46115edffb02187f6f9520617275 Mon Sep 17 00:00:00 2001 From: Shikha Mishra Date: Thu, 19 Aug 2021 01:31:21 +0530 Subject: [PATCH 06/14] Refactor testProductFromSpecificAndDefaultStore --- .../Catalog/ProductInMultipleStoresTest.php | 71 ++++++++++++------- 1 file changed, 44 insertions(+), 27 deletions(-) diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductInMultipleStoresTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductInMultipleStoresTest.php index 7c7212b9b9b26..3d0108bc97615 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductInMultipleStoresTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductInMultipleStoresTest.php @@ -25,31 +25,7 @@ class ProductInMultipleStoresTest extends GraphQlAbstract public function testProductFromSpecificAndDefaultStore() { $productSku = 'simple'; - - $query = <<getQuery($productSku); /** @var \Magento\Store\Model\Store $store */ $store = ObjectManager::getInstance()->get(\Magento\Store\Model\Store::class); @@ -89,12 +65,53 @@ public function testProductFromSpecificAndDefaultStore() $response['products']['items'][0]['name'], 'Product in the default store should be returned' ); + } - // use case for invalid storeCode + /** + * Test a product from a non existing store + * + * @magentoApiDataFixture Magento/Catalog/_files/product_simple.php + */ + public function testProductFromNonExistingStore() + { $nonExistingStoreCode = "non_existent_store"; $headerMapInvalidStoreCode = ['Store' => $nonExistingStoreCode]; $this->expectException(\Exception::class); $this->expectExceptionMessage('Requested store is not found'); - $this->graphQlQuery($query, [], '', $headerMapInvalidStoreCode); + $this->graphQlQuery($this->getQuery('simple'), [], '', $headerMapInvalidStoreCode); + } + + /** + * Return GraphQL query string by productSku + * + * @param string $productSku + * @return string + */ + private function getQuery(string $productSku): string + { + return << Date: Thu, 26 Aug 2021 19:42:14 +0530 Subject: [PATCH 07/14] Added Test for Translation --- .../HttpHeaderProcessor/StoreProcessor.php | 23 +++++++-- ...ProductSearchWithTranslatedMessageTest.php | 51 +++++++++++++++++++ .../_files/catalog_message_translate.php | 13 +++++ .../catalog_message_translate_rollback.php | 13 +++++ 4 files changed, 95 insertions(+), 5 deletions(-) create mode 100644 dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchWithTranslatedMessageTest.php create mode 100644 dev/tests/integration/testsuite/Magento/Translation/_files/catalog_message_translate.php create mode 100644 dev/tests/integration/testsuite/Magento/Translation/_files/catalog_message_translate_rollback.php diff --git a/app/code/Magento/StoreGraphQl/Controller/HttpHeaderProcessor/StoreProcessor.php b/app/code/Magento/StoreGraphQl/Controller/HttpHeaderProcessor/StoreProcessor.php index be205e53b7f61..cbaa4c1e634a3 100644 --- a/app/code/Magento/StoreGraphQl/Controller/HttpHeaderProcessor/StoreProcessor.php +++ b/app/code/Magento/StoreGraphQl/Controller/HttpHeaderProcessor/StoreProcessor.php @@ -1,8 +1,10 @@ storeManager = $storeManager; $this->httpContext = $httpContext; $this->storeCookieManager = $storeCookieManager; + $this->localeResolver = $localeResolver ?: ObjectManager::getInstance()->get(ResolverInterface::class); } /** @@ -60,9 +72,10 @@ public function processHeaderValue(string $headerValue): void if (!empty($headerValue)) { $storeCode = ltrim(rtrim($headerValue)); if ($this->isStoreValid($storeCode)) { + $this->localeResolver->emulate($this->storeManager->getStore($storeCode)->getId()); $this->storeManager->setCurrentStore($storeCode); $this->updateContext($storeCode); - } + } } elseif (!$this->isAlreadySet()) { $storeCode = $this->storeCookieManager->getStoreCodeFromCookie() ?: $this->storeManager->getDefaultStoreView()->getCode(); @@ -77,7 +90,7 @@ public function processHeaderValue(string $headerValue): void * @param string $storeCode * @return void */ - private function updateContext(string $storeCode) : void + private function updateContext(string $storeCode): void { $this->httpContext->setValue( StoreManagerInterface::CONTEXT_STORE, @@ -97,7 +110,7 @@ private function isAlreadySet(): bool return $this->httpContext->getValue($storeKey) !== null; } - + /** * Check if provided store code exist * @@ -112,4 +125,4 @@ private function isStoreValid(string $storeCode): bool } return false; } -} +} \ No newline at end of file diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchWithTranslatedMessageTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchWithTranslatedMessageTest.php new file mode 100644 index 0000000000000..5cd9435eff0dd --- /dev/null +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchWithTranslatedMessageTest.php @@ -0,0 +1,51 @@ + $storeCode]; + $this->expectException(\Exception::class); + $this->expectExceptionMessage('currentPage-waarde moet groter zijn dan 0.'); + $this->graphQlQuery($this->getQuery(), [], '', $header); + } + + + private function getQuery() + { + return <<create( + \Magento\Translation\Model\ResourceModel\StringUtils::class +); +$translateString->saveTranslate('currentPage value must be greater than 0.', 'currentPage-waarde moet groter zijn dan 0.', "nl_NL", 0); diff --git a/dev/tests/integration/testsuite/Magento/Translation/_files/catalog_message_translate_rollback.php b/dev/tests/integration/testsuite/Magento/Translation/_files/catalog_message_translate_rollback.php new file mode 100644 index 0000000000000..319ecbead796d --- /dev/null +++ b/dev/tests/integration/testsuite/Magento/Translation/_files/catalog_message_translate_rollback.php @@ -0,0 +1,13 @@ +create( + \Magento\Translation\Model\ResourceModel\StringUtils::class +); +$translateString->deleteTranslate('currentPage value must be greater than 0.', "nl_NL", 0); From e565f3f3fde010670b2698029fa67fbf4508fd29 Mon Sep 17 00:00:00 2001 From: shikhamis11 Date: Tue, 21 Sep 2021 10:14:00 +0530 Subject: [PATCH 08/14] Fixed static test --- app/code/Magento/GraphQl/Controller/GraphQl.php | 4 +++- .../Controller/HttpHeaderProcessor/StoreProcessor.php | 4 ++-- .../Catalog/ProductSearchWithTranslatedMessageTest.php | 1 - .../Translation/_files/catalog_message_translate.php | 8 +++++++- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/app/code/Magento/GraphQl/Controller/GraphQl.php b/app/code/Magento/GraphQl/Controller/GraphQl.php index e06a4db06db28..d02c4ef57cfc1 100644 --- a/app/code/Magento/GraphQl/Controller/GraphQl.php +++ b/app/code/Magento/GraphQl/Controller/GraphQl.php @@ -1,8 +1,10 @@ localeResolver->emulate($this->storeManager->getStore($storeCode)->getId()); $this->storeManager->setCurrentStore($storeCode); $this->updateContext($storeCode); - } + } } elseif (!$this->isAlreadySet()) { $storeCode = $this->storeCookieManager->getStoreCodeFromCookie() ?: $this->storeManager->getDefaultStoreView()->getCode(); @@ -125,4 +125,4 @@ private function isStoreValid(string $storeCode): bool } return false; } -} \ No newline at end of file +} diff --git a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchWithTranslatedMessageTest.php b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchWithTranslatedMessageTest.php index 5cd9435eff0dd..38486907b6718 100644 --- a/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchWithTranslatedMessageTest.php +++ b/dev/tests/api-functional/testsuite/Magento/GraphQl/Catalog/ProductSearchWithTranslatedMessageTest.php @@ -34,7 +34,6 @@ public function testErrorMessageTranslationInNonDefaultLocale() $this->graphQlQuery($this->getQuery(), [], '', $header); } - private function getQuery() { return <<create( \Magento\Translation\Model\ResourceModel\StringUtils::class ); -$translateString->saveTranslate('currentPage value must be greater than 0.', 'currentPage-waarde moet groter zijn dan 0.', "nl_NL", 0); +$translateString->saveTranslate( + 'currentPage value must be greater than 0.', + 'currentPage-waarde moet groter zijn dan 0.', + "nl_NL", + 0 +); From b51f420caee77bd91f0f7e7541491ed4d61bd298 Mon Sep 17 00:00:00 2001 From: shikhamis11 Date: Tue, 21 Sep 2021 13:33:51 +0530 Subject: [PATCH 09/14] Fixed static test --- app/code/Magento/GraphQl/Controller/GraphQl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/GraphQl/Controller/GraphQl.php b/app/code/Magento/GraphQl/Controller/GraphQl.php index d02c4ef57cfc1..12b08a7e18c3e 100644 --- a/app/code/Magento/GraphQl/Controller/GraphQl.php +++ b/app/code/Magento/GraphQl/Controller/GraphQl.php @@ -96,7 +96,7 @@ class GraphQl implements FrontControllerInterface private $contextFactory; /** - * @var AreaList $areaList + * @var AreaList */ private $areaList; From 379d2b008678cc33ae221b0a0da08d14d43e285d Mon Sep 17 00:00:00 2001 From: shikhamis11 Date: Tue, 21 Sep 2021 15:08:11 +0530 Subject: [PATCH 10/14] Fixed static test --- app/code/Magento/GraphQl/Controller/GraphQl.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/GraphQl/Controller/GraphQl.php b/app/code/Magento/GraphQl/Controller/GraphQl.php index 12b08a7e18c3e..0f8c8022b23f2 100644 --- a/app/code/Magento/GraphQl/Controller/GraphQl.php +++ b/app/code/Magento/GraphQl/Controller/GraphQl.php @@ -95,7 +95,7 @@ class GraphQl implements FrontControllerInterface */ private $contextFactory; - /** + /** * @var AreaList */ private $areaList; From 0cef6782e35ef00e02794630c0594746c02a0f1c Mon Sep 17 00:00:00 2001 From: Shikha Mishra Date: Wed, 29 Sep 2021 23:24:45 +0530 Subject: [PATCH 11/14] Fixed fatal error with non existing store --- .../HttpHeaderProcessor/StoreProcessor.php | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/app/code/Magento/StoreGraphQl/Controller/HttpHeaderProcessor/StoreProcessor.php b/app/code/Magento/StoreGraphQl/Controller/HttpHeaderProcessor/StoreProcessor.php index 8bba0a08a2f3d..5ef3c46ec93cc 100644 --- a/app/code/Magento/StoreGraphQl/Controller/HttpHeaderProcessor/StoreProcessor.php +++ b/app/code/Magento/StoreGraphQl/Controller/HttpHeaderProcessor/StoreProcessor.php @@ -15,6 +15,7 @@ use Magento\Store\Api\StoreCookieManagerInterface; use Magento\Framework\App\ObjectManager; use Magento\Framework\Locale\ResolverInterface; +use Psr\Log\LoggerInterface; /** * Process the "Store" header entry @@ -41,22 +42,30 @@ class StoreProcessor implements HttpHeaderProcessorInterface */ private $localeResolver; + /** + * @var LoggerInterface + */ + private $logger; + /** * @param StoreManagerInterface $storeManager * @param HttpContext $httpContext * @param StoreCookieManagerInterface $storeCookieManager * @param ResolverInterface $localeResolver + * @param LoggerInterface $logger */ public function __construct( StoreManagerInterface $storeManager, HttpContext $httpContext, StoreCookieManagerInterface $storeCookieManager, - ResolverInterface $localeResolver = null + ResolverInterface $localeResolver = null, + LoggerInterface $logger = null ) { $this->storeManager = $storeManager; $this->httpContext = $httpContext; $this->storeCookieManager = $storeCookieManager; $this->localeResolver = $localeResolver ?: ObjectManager::getInstance()->get(ResolverInterface::class); + $this->logger = $logger ?: ObjectManager::getInstance()->get(LoggerInterface::class); } /** @@ -71,10 +80,14 @@ public function processHeaderValue(string $headerValue): void { if (!empty($headerValue)) { $storeCode = ltrim(rtrim($headerValue)); - if ($this->isStoreValid($storeCode)) { + try { $this->localeResolver->emulate($this->storeManager->getStore($storeCode)->getId()); + // $this->storeManager->getStore($storeCode) throws error with non existing stores + // and logged in the catch $this->storeManager->setCurrentStore($storeCode); $this->updateContext($storeCode); + } catch (\Exception $e) { + $this->logger->error($e->getMessage()); } } elseif (!$this->isAlreadySet()) { $storeCode = $this->storeCookieManager->getStoreCodeFromCookie() @@ -110,19 +123,4 @@ private function isAlreadySet(): bool return $this->httpContext->getValue($storeKey) !== null; } - - /** - * Check if provided store code exist - * - * @param string $storeCode - * @return bool - */ - private function isStoreValid(string $storeCode): bool - { - $stores = $this->storeManager->getStores(true, true); - if (isset($stores[$storeCode])) { - return true; - } - return false; - } } From f3fc159483759197a8f7feea02c64da9d68c3066 Mon Sep 17 00:00:00 2001 From: Shikha Mishra Date: Thu, 30 Sep 2021 00:45:09 +0530 Subject: [PATCH 12/14] Fixed Static test --- .../Controller/HttpHeaderProcessor/StoreProcessor.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/code/Magento/StoreGraphQl/Controller/HttpHeaderProcessor/StoreProcessor.php b/app/code/Magento/StoreGraphQl/Controller/HttpHeaderProcessor/StoreProcessor.php index 5ef3c46ec93cc..b9cf231a58378 100644 --- a/app/code/Magento/StoreGraphQl/Controller/HttpHeaderProcessor/StoreProcessor.php +++ b/app/code/Magento/StoreGraphQl/Controller/HttpHeaderProcessor/StoreProcessor.php @@ -82,7 +82,7 @@ public function processHeaderValue(string $headerValue): void $storeCode = ltrim(rtrim($headerValue)); try { $this->localeResolver->emulate($this->storeManager->getStore($storeCode)->getId()); - // $this->storeManager->getStore($storeCode) throws error with non existing stores + // $this->storeManager->getStore($storeCode) throws error with non existing stores // and logged in the catch $this->storeManager->setCurrentStore($storeCode); $this->updateContext($storeCode); From 2f656a6d4ed533d31178996f8767efe856f4c529 Mon Sep 17 00:00:00 2001 From: Shikha Mishra Date: Fri, 1 Oct 2021 15:46:57 +0530 Subject: [PATCH 13/14] Fixed Parameters order --- .../Magento/GraphQl/Controller/GraphQl.php | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/code/Magento/GraphQl/Controller/GraphQl.php b/app/code/Magento/GraphQl/Controller/GraphQl.php index 0f8c8022b23f2..db001f4c99918 100644 --- a/app/code/Magento/GraphQl/Controller/GraphQl.php +++ b/app/code/Magento/GraphQl/Controller/GraphQl.php @@ -95,11 +95,6 @@ class GraphQl implements FrontControllerInterface */ private $contextFactory; - /** - * @var AreaList - */ - private $areaList; - /** * @var LogData */ @@ -110,6 +105,11 @@ class GraphQl implements FrontControllerInterface */ private $loggerPool; + /** + * @var AreaList + */ + private $areaList; + /** * @param Response $response * @param SchemaGeneratorInterface $schemaGenerator @@ -122,9 +122,9 @@ class GraphQl implements FrontControllerInterface * @param JsonFactory|null $jsonFactory * @param HttpResponse|null $httpResponse * @param ContextFactoryInterface $contextFactory - * @param AreaList $areaList * @param LogData $logDataHelper * @param LoggerPool $loggerPool + * @param AreaList $areaList * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct( @@ -139,9 +139,9 @@ public function __construct( JsonFactory $jsonFactory = null, HttpResponse $httpResponse = null, ContextFactoryInterface $contextFactory = null, - AreaList $areaList = null, LogData $logDataHelper = null, - LoggerPool $loggerPool = null + LoggerPool $loggerPool = null, + AreaList $areaList = null ) { $this->response = $response; $this->schemaGenerator = $schemaGenerator; @@ -154,9 +154,9 @@ public function __construct( $this->jsonFactory = $jsonFactory ?: ObjectManager::getInstance()->get(JsonFactory::class); $this->httpResponse = $httpResponse ?: ObjectManager::getInstance()->get(HttpResponse::class); $this->contextFactory = $contextFactory ?: ObjectManager::getInstance()->get(ContextFactoryInterface::class); - $this->areaList = $areaList ?: ObjectManager::getInstance()->get(AreaList::class); $this->logDataHelper = $logDataHelper ?: ObjectManager::getInstance()->get(LogData::class); $this->loggerPool = $loggerPool ?: ObjectManager::getInstance()->get(LoggerPool::class); + $this->areaList = $areaList ?: ObjectManager::getInstance()->get(AreaList::class); } /** From c7ed1e5f52f7420ea37a4054dd117e5feadc9b20 Mon Sep 17 00:00:00 2001 From: Shikha Mishra Date: Tue, 7 Dec 2021 10:32:47 +0530 Subject: [PATCH 14/14] Updated constructor comment --- app/code/Magento/GraphQl/Controller/GraphQl.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app/code/Magento/GraphQl/Controller/GraphQl.php b/app/code/Magento/GraphQl/Controller/GraphQl.php index db001f4c99918..2eb5aa81c17b5 100644 --- a/app/code/Magento/GraphQl/Controller/GraphQl.php +++ b/app/code/Magento/GraphQl/Controller/GraphQl.php @@ -121,10 +121,10 @@ class GraphQl implements FrontControllerInterface * @param QueryFields $queryFields * @param JsonFactory|null $jsonFactory * @param HttpResponse|null $httpResponse - * @param ContextFactoryInterface $contextFactory - * @param LogData $logDataHelper - * @param LoggerPool $loggerPool - * @param AreaList $areaList + * @param ContextFactoryInterface|null $contextFactory + * @param LogData|null $logDataHelper + * @param LoggerPool|null $loggerPool + * @param AreaList|null $areaList * @SuppressWarnings(PHPMD.ExcessiveParameterList) */ public function __construct(