1010use Magento \Customer \Model \Session ;
1111use Magento \Framework \App \Action \HttpGetActionInterface ;
1212use Magento \Framework \App \RequestInterface ;
13+ use Magento \Framework \App \Response \Http ;
1314use Magento \Framework \Controller \Result \Redirect ;
1415use Magento \Framework \Controller \ResultFactory ;
1516use Magento \Framework \Message \ManagerInterface ;
2021
2122class Erase extends AbstractPrivacy implements HttpGetActionInterface
2223{
23- /**
24- * @var Session
25- */
26- private $ session ;
27-
2824 /**
2925 * @var EraseEntityCheckerInterface
3026 */
@@ -35,12 +31,12 @@ public function __construct(
3531 ResultFactory $ resultFactory ,
3632 ManagerInterface $ messageManager ,
3733 Config $ config ,
38- Session $ session ,
34+ Session $ customerSession ,
35+ Http $ response ,
3936 EraseEntityCheckerInterface $ eraseCustomerChecker
4037 ) {
41- $ this ->session = $ session ;
4238 $ this ->eraseCustomerChecker = $ eraseCustomerChecker ;
43- parent ::__construct ($ request , $ resultFactory , $ messageManager , $ config );
39+ parent ::__construct ($ request , $ resultFactory , $ messageManager , $ config, $ customerSession , $ response );
4440 }
4541
4642 protected function isAllowed (): bool
@@ -50,7 +46,7 @@ protected function isAllowed(): bool
5046
5147 protected function executeAction ()
5248 {
53- if ($ this ->eraseCustomerChecker ->exists ((int ) $ this ->session ->getCustomerId (), 'customer ' )) {
49+ if ($ this ->eraseCustomerChecker ->exists ((int ) $ this ->customerSession ->getCustomerId (), 'customer ' )) {
5450 $ this ->messageManager ->addErrorMessage (new Phrase ('Your account is already being removed. ' ));
5551 /** @var Redirect $resultRedirect */
5652 $ resultRedirect = $ this ->resultFactory ->create (ResultFactory::TYPE_REDIRECT );
0 commit comments