20
20
use Magento \Framework \Encryption \EncryptorInterface as Encryptor ;
21
21
use Magento \Customer \Model \CustomerRegistry ;
22
22
23
-
24
23
/**
25
24
* Customers field resolver, used for GraphQL request processing.
26
25
*/
@@ -46,11 +45,6 @@ class CustomerUpdate implements ResolverInterface
46
45
*/
47
46
protected $ subscriberFactory ;
48
47
49
- /**
50
- * @var AuthenticationInterface
51
- */
52
- private $ authentication ;
53
-
54
48
/**
55
49
* @var CustomerRegistry
56
50
*/
@@ -118,33 +112,27 @@ public function resolve(
118
112
if (isset ($ args ['firstname ' ])) {
119
113
$ customer ->setFirstname ($ args ['firstname ' ]);
120
114
}
121
- if (isset ($ args ['lastname ' ])){
115
+ if (isset ($ args ['lastname ' ])) {
122
116
$ customer ->setLastname ($ args ['lastname ' ]);
123
117
}
124
118
125
119
$ customer ->setStoreId ($ this ->storeResolver ->getCurrentStoreId ());
126
120
$ this ->customerRepository ->save ($ customer );
127
121
128
122
if (isset ($ args ['is_subscribed ' ])) {
129
-
130
123
$ checkSubscriber = $ this ->subscriberFactory ->create ()->loadByCustomerId ($ context ->getUserId ());
131
-
132
124
if ($ args ['is_subscribed ' ] === true && !$ checkSubscriber ->isSubscribed ()) {
133
125
$ this ->subscriberFactory ->create ()->subscribeCustomerById ($ context ->getUserId ());
134
126
} elseif ($ args ['is_subscribed ' ] === false && $ checkSubscriber ->isSubscribed ()) {
135
127
$ this ->subscriberFactory ->create ()->unsubscribeCustomerById ($ context ->getUserId ());
136
128
}
137
129
}
138
130
139
-
140
131
$ data = $ args ;
141
132
$ result = function () use ($ data ) {
142
133
return !empty ($ data ) ? $ data : [];
143
134
};
144
135
145
136
return $ this ->valueFactory ->create ($ result );
146
-
147
-
148
137
}
149
-
150
138
}
0 commit comments