1313use Magento \Customer \Model \Config \Share ;
1414use Magento \Customer \Model \ResourceModel \Customer as ResourceCustomer ;
1515use Magento \Framework \App \ObjectManager ;
16- use Magento \Framework \Exception \NoSuchEntityException ;
1716use Magento \Framework \Session \Generic ;
1817
1918/**
@@ -108,11 +107,6 @@ class Session extends \Magento\Framework\Session\SessionManager
108107 */
109108 private $ accountConfirmation ;
110109
111- /**
112- * @var CustomerRegistry
113- */
114- private $ customerRegistry ;
115-
116110 /**
117111 * Session constructor.
118112 *
@@ -138,7 +132,6 @@ class Session extends \Magento\Framework\Session\SessionManager
138132 * @param GroupManagementInterface $groupManagement
139133 * @param \Magento\Framework\App\Response\Http $response
140134 * @param AccountConfirmation $accountConfirmation
141- * @param CustomerRegistry $customerRegistry
142135 * @throws \Magento\Framework\Exception\SessionException
143136 * @SuppressWarnings(PHPMD.ExcessiveParameterList)
144137 */
@@ -164,8 +157,7 @@ public function __construct(
164157 CustomerRepositoryInterface $ customerRepository ,
165158 GroupManagementInterface $ groupManagement ,
166159 \Magento \Framework \App \Response \Http $ response ,
167- AccountConfirmation $ accountConfirmation = null ,
168- CustomerRegistry $ customerRegistry = null
160+ AccountConfirmation $ accountConfirmation = null
169161 ) {
170162 $ this ->_coreUrl = $ coreUrl ;
171163 $ this ->_customerUrl = $ customerUrl ;
@@ -181,8 +173,6 @@ public function __construct(
181173 $ this ->response = $ response ;
182174 $ this ->accountConfirmation = $ accountConfirmation ?: ObjectManager::getInstance ()
183175 ->get (AccountConfirmation::class);
184- $ this ->customerRegistry = $ customerRegistry ?: ObjectManager::getInstance ()
185- ->get (CustomerRegistry::class);
186176 parent ::__construct (
187177 $ request ,
188178 $ sidResolver ,
@@ -309,15 +299,14 @@ public function setCustomer(Customer $customerModel)
309299 *
310300 * @return Customer
311301 * use getCustomerId() instead
312- * @throws NoSuchEntityException
313302 */
314303 public function getCustomer ()
315304 {
316305 if ($ this ->_customerModel === null ) {
317306 $ this ->_customerModel = $ this ->_customerFactory ->create ();
318307
319308 if ($ this ->getCustomerId ()) {
320- $ this ->_customerModel = $ this ->customerRegistry -> retrieve ( $ this ->getCustomerId ());
309+ $ this ->_customerResource -> load ( $ this ->_customerModel , $ this ->getCustomerId ());
321310 }
322311 }
323312
@@ -396,8 +385,8 @@ public function getCustomerGroupId()
396385 if ($ this ->storage ->getData ('customer_group_id ' )) {
397386 return $ this ->storage ->getData ('customer_group_id ' );
398387 }
399- if ($ this ->getCustomer ()) {
400- $ customerGroupId = $ this ->getCustomer ()->getGroupId ();
388+ if ($ this ->getCustomerData ()) {
389+ $ customerGroupId = $ this ->getCustomerData ()->getGroupId ();
401390 $ this ->setCustomerGroupId ($ customerGroupId );
402391 return $ customerGroupId ;
403392 }
@@ -442,7 +431,7 @@ public function checkCustomerId($customerId)
442431 }
443432
444433 try {
445- $ this ->customerRegistry -> retrieve ($ customerId );
434+ $ this ->customerRepository -> getById ($ customerId );
446435 $ this ->_isCustomerIdChecked = $ customerId ;
447436 return true ;
448437 } catch (\Exception $ e ) {
0 commit comments