2020use Magento \Framework \Encryption \EncryptorInterface as Encryptor ;
2121use Magento \Customer \Model \CustomerRegistry ;
2222
23-
2423/**
2524 * Customers field resolver, used for GraphQL request processing.
2625 */
@@ -46,11 +45,6 @@ class CustomerUpdate implements ResolverInterface
4645 */
4746 protected $ subscriberFactory ;
4847
49- /**
50- * @var AuthenticationInterface
51- */
52- private $ authentication ;
53-
5448 /**
5549 * @var CustomerRegistry
5650 */
@@ -118,33 +112,27 @@ public function resolve(
118112 if (isset ($ args ['firstname ' ])) {
119113 $ customer ->setFirstname ($ args ['firstname ' ]);
120114 }
121- if (isset ($ args ['lastname ' ])){
115+ if (isset ($ args ['lastname ' ])) {
122116 $ customer ->setLastname ($ args ['lastname ' ]);
123117 }
124118
125119 $ customer ->setStoreId ($ this ->storeResolver ->getCurrentStoreId ());
126120 $ this ->customerRepository ->save ($ customer );
127121
128122 if (isset ($ args ['is_subscribed ' ])) {
129-
130123 $ checkSubscriber = $ this ->subscriberFactory ->create ()->loadByCustomerId ($ context ->getUserId ());
131-
132124 if ($ args ['is_subscribed ' ] === true && !$ checkSubscriber ->isSubscribed ()) {
133125 $ this ->subscriberFactory ->create ()->subscribeCustomerById ($ context ->getUserId ());
134126 } elseif ($ args ['is_subscribed ' ] === false && $ checkSubscriber ->isSubscribed ()) {
135127 $ this ->subscriberFactory ->create ()->unsubscribeCustomerById ($ context ->getUserId ());
136128 }
137129 }
138130
139-
140131 $ data = $ args ;
141132 $ result = function () use ($ data ) {
142133 return !empty ($ data ) ? $ data : [];
143134 };
144135
145136 return $ this ->valueFactory ->create ($ result );
146-
147-
148137 }
149-
150138}
0 commit comments