Skip to content

Commit

Permalink
#9236: remove the usage of the Json Data Helper
Browse files Browse the repository at this point in the history
 - replace the json data helper usage in the admin controller with the results factory
 - create a result of type json,
 - set the data array on the result type
  • Loading branch information
dmanners committed Mar 29, 2018
1 parent cdca73b commit 6561541
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
*/
namespace Magento\AdminNotification\Controller\Adminhtml\System\Message;

use Magento\Framework\Controller\ResultFactory;

class ListAction extends \Magento\Backend\App\AbstractAction
{
/**
Expand All @@ -15,6 +17,7 @@ class ListAction extends \Magento\Backend\App\AbstractAction

/**
* @var \Magento\Framework\Json\Helper\Data
* @deprecated
*/
protected $jsonHelper;

Expand All @@ -41,7 +44,7 @@ public function __construct(
}

/**
* @return void
* @return \Magento\Framework\Controller\Result\Json
*/
public function execute()
{
Expand All @@ -63,6 +66,9 @@ public function execute()
. 'Please refresh the web page to clear the notice alert.',
];
}
$this->getResponse()->representJson($this->jsonHelper->jsonEncode($result));
/** @var \Magento\Framework\Controller\Result\Json $resultJson */
$resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
$resultJson->setData($result);
return $resultJson;
}
}

0 comments on commit 6561541

Please sign in to comment.