diff --git a/Block/Newsletter.php b/Block/Newsletter.php index 6c8458f2..c4dfd4e3 100644 --- a/Block/Newsletter.php +++ b/Block/Newsletter.php @@ -13,10 +13,9 @@ namespace Ebizmarts\MailChimp\Block; -use Magento\Customer\Controller\RegistryConstants; use Magento\Framework\Exception\NoSuchEntityException; use Magento\Customer\Api\CustomerRepositoryInterface; -use Magento\Framework\Registry; +use Magento\Customer\Model\Session; class Newsletter extends \Magento\Framework\View\Element\Template { @@ -37,17 +36,17 @@ class Newsletter extends \Magento\Framework\View\Element\Template */ private $customerRepository; /** - * @var Registry + * @var Session */ - private $registry; + private $session; /** * @param \Magento\Framework\View\Element\Template\Context $context - * @param \Magento\Customer\Model\Session $customerSession + * @param Session $customerSession * @param \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory * @param \Ebizmarts\MailChimp\Helper\Data $helper * @param CustomerRepositoryInterface $customerRepository - * @param Registry $registry + * @param Session $session * @param array $data */ public function __construct( @@ -56,16 +55,15 @@ public function __construct( \Magento\Newsletter\Model\SubscriberFactory $subscriberFactory, \Ebizmarts\MailChimp\Helper\Data $helper, CustomerRepositoryInterface $customerRepository, - Registry $registry, + Session $session, array $data ) { - parent::__construct($context, $data); $this->_helper = $helper; $this->subscriberFactory = $subscriberFactory; $this->customerSession = $customerSession; $this->customerRepository = $customerRepository; - $this->registry = $registry; + $this->session = $session; } public function getInterest() @@ -73,7 +71,6 @@ public function getInterest() $customer = $this->getCurrentCustomer(); $subscriber = $this->subscriberFactory->create(); $subscriber->loadByCustomer($customer->getId(),$customer->getStoreId()); -// $subscriber = $this->getSubscriptionObject(); return $this->_helper->getSubscriberInterest($subscriber->getSubscriberId(), $subscriber->getStoreId()); } public function getFormUrl() @@ -93,7 +90,6 @@ private function getCurrentCustomer() } private function getCurrentCustomerId(): int { - return (int)$this->registry->registry(RegistryConstants::CURRENT_CUSTOMER_ID); + return $this->session->getCustomerId(); } - }