Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Dismiss.php
Go to the documentation of this file.
1 <?php
7 
12 
16 class Dismiss extends Action
17 {
21  private $notificationManagement;
22 
29  public function __construct(
30  Context $context,
31  BulkNotificationManagement $notificationManagement
32  ) {
33  parent::__construct($context);
34  $this->notificationManagement = $notificationManagement;
35  }
36 
40  protected function _isAllowed()
41  {
42  return $this->_authorization->isAllowed('Magento_Logging::system_magento_logging_bulk_operations');
43  }
44 
48  public function execute()
49  {
50  $bulkUuids = [];
51  foreach ((array)$this->getRequest()->getParam('uuid', []) as $bulkUuid) {
52  $bulkUuids[] = (string)$bulkUuid;
53  }
54 
55  $isAcknowledged = $this->notificationManagement->acknowledgeBulks($bulkUuids);
56 
58  $result = $this->resultFactory->create(ResultFactory::TYPE_JSON);
59  if (!$isAcknowledged) {
60  $result->setHttpResponseCode(400);
61  }
62 
63  return $result;
64  }
65 }
__construct(Context $context, BulkNotificationManagement $notificationManagement)
Definition: Dismiss.php:29