26
26
use Magento \Framework \Api \SearchCriteria \CollectionProcessorInterface ;
27
27
use Magento \Framework \Api \SearchCriteriaInterface ;
28
28
use Magento \Framework \App \ObjectManager ;
29
- use Magento \Framework \EntityManager \HydratorInterface ;
30
29
use Magento \Framework \Event \ManagerInterface ;
31
30
use Magento \Store \Model \StoreManagerInterface ;
32
31
@@ -120,11 +119,6 @@ class CustomerRepository implements CustomerRepositoryInterface
120
119
*/
121
120
private $ delegatedStorage ;
122
121
123
- /**
124
- * @var HydratorInterface
125
- */
126
- private $ hydrator ;
127
-
128
122
/**
129
123
* @param CustomerFactory $customerFactory
130
124
* @param CustomerSecureFactory $customerSecureFactory
@@ -142,7 +136,6 @@ class CustomerRepository implements CustomerRepositoryInterface
142
136
* @param CollectionProcessorInterface $collectionProcessor
143
137
* @param NotificationStorage $notificationStorage
144
138
* @param DelegatedStorage|null $delegatedStorage
145
- * @param HydratorInterface|null $hydrator
146
139
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
147
140
*/
148
141
public function __construct (
@@ -161,8 +154,7 @@ public function __construct(
161
154
JoinProcessorInterface $ extensionAttributesJoinProcessor ,
162
155
CollectionProcessorInterface $ collectionProcessor ,
163
156
NotificationStorage $ notificationStorage ,
164
- DelegatedStorage $ delegatedStorage = null ,
165
- ?HydratorInterface $ hydrator = null
157
+ DelegatedStorage $ delegatedStorage = null
166
158
) {
167
159
$ this ->customerFactory = $ customerFactory ;
168
160
$ this ->customerSecureFactory = $ customerSecureFactory ;
@@ -180,7 +172,6 @@ public function __construct(
180
172
$ this ->collectionProcessor = $ collectionProcessor ;
181
173
$ this ->notificationStorage = $ notificationStorage ;
182
174
$ this ->delegatedStorage = $ delegatedStorage ?? ObjectManager::getInstance ()->get (DelegatedStorage::class);
183
- $ this ->hydrator = $ hydrator ?: ObjectManager::getInstance ()->get (HydratorInterface::class);
184
175
}
185
176
186
177
/**
@@ -194,7 +185,6 @@ public function __construct(
194
185
* @throws \Magento\Framework\Exception\LocalizedException
195
186
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
196
187
* @SuppressWarnings(PHPMD.NPathComplexity)
197
- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
198
188
*/
199
189
public function save (CustomerInterface $ customer , $ passwordHash = null )
200
190
{
@@ -203,11 +193,10 @@ public function save(CustomerInterface $customer, $passwordHash = null)
203
193
$ prevCustomerData = $ prevCustomerDataArr = null ;
204
194
if ($ customer ->getId ()) {
205
195
$ prevCustomerData = $ this ->getById ($ customer ->getId ());
206
- $ prevCustomerDataArr = $ this ->hydrator ->extract ($ prevCustomerData );
207
- $ customer = $ this ->hydrator ->hydrate ($ prevCustomerData , $ customer ->__toArray ());
196
+ $ prevCustomerDataArr = $ prevCustomerData ->__toArray ();
208
197
}
209
198
/** @var $customer \Magento\Customer\Model\Data\Customer */
210
- $ customerArr = $ this -> hydrator -> extract ( $ customer );
199
+ $ customerArr = $ customer -> __toArray ( );
211
200
$ customer = $ this ->imageProcessor ->save (
212
201
$ customer ,
213
202
CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER ,
0 commit comments