Skip to content
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
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
13 changes: 12 additions & 1 deletion app/code/Magento/GraphQl/Controller/GraphQl.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -88,6 +90,11 @@ class GraphQl implements FrontControllerInterface
* @var ContextFactoryInterface
*/
private $contextFactory;

/**
* @var AreaList $areaList
*/
private $appState;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think private $appState; should be change into private $areaList;

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. Stupid me. I had an error here before but only half fixed it.


/**
* @param Response $response
Expand All @@ -114,7 +121,8 @@ public function __construct(
QueryFields $queryFields,
JsonFactory $jsonFactory = null,
HttpResponse $httpResponse = null,
ContextFactoryInterface $contextFactory = null
ContextFactoryInterface $contextFactory = null,
AreaList $areaList
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
AreaList $areaList
AreaList $areaList = null

) {
$this->response = $response;
$this->schemaGenerator = $schemaGenerator;
Expand All @@ -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;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
$this->areaList = $areaList;
$this->areaList = $areaList ?: ObjectManager::getInstance()->get(AreaList::class);

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see the updated PR.

}

/**
Expand All @@ -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 {
Expand Down