55 */
66namespace Magento \Customer \Controller \Adminhtml \Index ;
77
8+ use Magento \Backend \Model \View \Result \Redirect ;
89use Magento \Customer \Api \CustomerRepositoryInterface ;
910use Magento \Customer \Api \Data \CustomerInterface ;
1011use Magento \Customer \Model \Config \Share ;
@@ -48,6 +49,7 @@ class MassUnsubscribe extends AbstractMassAction implements HttpPostActionInterf
4849 * @param CollectionFactory $collectionFactory
4950 * @param CustomerRepositoryInterface $customerRepository
5051 * @param SubscriptionManagerInterface $subscriptionManager
52+ * @param StoreManagerInterface $storeManager
5153 * @param Share $shareConfig
5254 */
5355 public function __construct (
@@ -70,13 +72,13 @@ public function __construct(
7072 * Customer mass unsubscribe action
7173 *
7274 * @param AbstractCollection $collection
73- * @return \Magento\Backend\Model\View\Result\ Redirect
75+ * @return Redirect
7476 */
7577 protected function massAction (AbstractCollection $ collection )
7678 {
7779 $ customersUpdated = 0 ;
7880 foreach ($ collection ->getAllIds () as $ customerId ) {
79- // Verify customer exists
81+ // Verify that customer exists
8082 $ customer = $ this ->customerRepository ->getById ($ customerId );
8183 foreach ($ this ->getUnsubscribeStoreIds ($ customer ) as $ storeId ) {
8284 $ this ->subscriptionManager ->unsubscribeCustomer ((int )$ customerId , $ storeId );
@@ -87,7 +89,7 @@ protected function massAction(AbstractCollection $collection)
8789 if ($ customersUpdated ) {
8890 $ this ->messageManager ->addSuccessMessage (__ ('A total of %1 record(s) were updated. ' , $ customersUpdated ));
8991 }
90- /** @var \Magento\Backend\Model\View\Result\ Redirect $resultRedirect */
92+ /** @var Redirect $resultRedirect */
9193 $ resultRedirect = $ this ->resultFactory ->create (ResultFactory::TYPE_REDIRECT );
9294 $ resultRedirect ->setPath ($ this ->getComponentRefererUrl ());
9395
0 commit comments