5
5
*/
6
6
namespace Magento \Customer \Controller \Adminhtml \Index ;
7
7
8
+ use Magento \Backend \Model \View \Result \Redirect ;
8
9
use Magento \Customer \Api \CustomerRepositoryInterface ;
9
10
use Magento \Customer \Api \Data \CustomerInterface ;
10
11
use Magento \Customer \Model \Config \Share ;
@@ -48,6 +49,7 @@ class MassUnsubscribe extends AbstractMassAction implements HttpPostActionInterf
48
49
* @param CollectionFactory $collectionFactory
49
50
* @param CustomerRepositoryInterface $customerRepository
50
51
* @param SubscriptionManagerInterface $subscriptionManager
52
+ * @param StoreManagerInterface $storeManager
51
53
* @param Share $shareConfig
52
54
*/
53
55
public function __construct (
@@ -70,13 +72,13 @@ public function __construct(
70
72
* Customer mass unsubscribe action
71
73
*
72
74
* @param AbstractCollection $collection
73
- * @return \Magento\Backend\Model\View\Result\ Redirect
75
+ * @return Redirect
74
76
*/
75
77
protected function massAction (AbstractCollection $ collection )
76
78
{
77
79
$ customersUpdated = 0 ;
78
80
foreach ($ collection ->getAllIds () as $ customerId ) {
79
- // Verify customer exists
81
+ // Verify that customer exists
80
82
$ customer = $ this ->customerRepository ->getById ($ customerId );
81
83
foreach ($ this ->getUnsubscribeStoreIds ($ customer ) as $ storeId ) {
82
84
$ this ->subscriptionManager ->unsubscribeCustomer ((int )$ customerId , $ storeId );
@@ -87,7 +89,7 @@ protected function massAction(AbstractCollection $collection)
87
89
if ($ customersUpdated ) {
88
90
$ this ->messageManager ->addSuccessMessage (__ ('A total of %1 record(s) were updated. ' , $ customersUpdated ));
89
91
}
90
- /** @var \Magento\Backend\Model\View\Result\ Redirect $resultRedirect */
92
+ /** @var Redirect $resultRedirect */
91
93
$ resultRedirect = $ this ->resultFactory ->create (ResultFactory::TYPE_REDIRECT );
92
94
$ resultRedirect ->setPath ($ this ->getComponentRefererUrl ());
93
95
0 commit comments