@@ -81,7 +81,8 @@ public function afterSave(CustomerRepository $subject, CustomerInterface $result
81
81
}
82
82
$ newExtensionAttributes = $ customer ->getExtensionAttributes ();
83
83
if ($ newExtensionAttributes
84
- && $ initialExtensionAttributes ->getIsSubscribed () !== $ newExtensionAttributes ->getIsSubscribed ()) {
84
+ && $ initialExtensionAttributes ->getIsSubscribed () !== $ newExtensionAttributes ->getIsSubscribed ()
85
+ ) {
85
86
if ($ newExtensionAttributes ->getIsSubscribed () === true ) {
86
87
$ subscriber ->subscribeCustomerById ($ resultId );
87
88
} elseif ($ newExtensionAttributes ->getIsSubscribed () === false ) {
@@ -149,18 +150,13 @@ public function afterGetById(CustomerRepository $subject, CustomerInterface $cus
149
150
{
150
151
$ extensionAttributes = $ customer ->getExtensionAttributes ();
151
152
if ($ extensionAttributes === null ) {
152
- /** @var CustomerExtensionInterface $customerExtension */
153
- $ customerExtension = $ this ->extensionFactory ->create (CustomerInterface::class);
154
- $ isSubscribed = $ this ->isSubscribed ($ customer );
155
- $ customerExtension ->setIsSubscribed ($ isSubscribed );
156
- $ customer ->setExtensionAttributes ($ customerExtension );
157
- return $ customer ;
153
+ /** @var CustomerExtensionInterface $extensionAttributes */
154
+ $ extensionAttributes = $ this ->extensionFactory ->create (CustomerInterface::class);
155
+ $ customer ->setExtensionAttributes ($ extensionAttributes );
158
156
}
159
157
if ($ extensionAttributes ->getIsSubscribed () === null ) {
160
158
$ isSubscribed = $ this ->isSubscribed ($ customer );
161
159
$ extensionAttributes ->setIsSubscribed ($ isSubscribed );
162
- $ customer ->setExtensionAttributes ($ extensionAttributes );
163
- return $ customer ;
164
160
}
165
161
return $ customer ;
166
162
}
0 commit comments