2626use Magento \Framework \Api \SearchCriteria \CollectionProcessorInterface ;
2727use Magento \Framework \Api \SearchCriteriaInterface ;
2828use Magento \Framework \App \ObjectManager ;
29- use Magento \Framework \EntityManager \HydratorInterface ;
3029use Magento \Framework \Event \ManagerInterface ;
3130use Magento \Store \Model \StoreManagerInterface ;
3231
@@ -120,11 +119,6 @@ class CustomerRepository implements CustomerRepositoryInterface
120119 */
121120 private $ delegatedStorage ;
122121
123- /**
124- * @var HydratorInterface
125- */
126- private $ hydrator ;
127-
128122 /**
129123 * @param CustomerFactory $customerFactory
130124 * @param CustomerSecureFactory $customerSecureFactory
@@ -142,7 +136,6 @@ class CustomerRepository implements CustomerRepositoryInterface
142136 * @param CollectionProcessorInterface $collectionProcessor
143137 * @param NotificationStorage $notificationStorage
144138 * @param DelegatedStorage|null $delegatedStorage
145- * @param HydratorInterface|null $hydrator
146139 * @SuppressWarnings(PHPMD.ExcessiveParameterList)
147140 */
148141 public function __construct (
@@ -161,8 +154,7 @@ public function __construct(
161154 JoinProcessorInterface $ extensionAttributesJoinProcessor ,
162155 CollectionProcessorInterface $ collectionProcessor ,
163156 NotificationStorage $ notificationStorage ,
164- DelegatedStorage $ delegatedStorage = null ,
165- ?HydratorInterface $ hydrator = null
157+ DelegatedStorage $ delegatedStorage = null
166158 ) {
167159 $ this ->customerFactory = $ customerFactory ;
168160 $ this ->customerSecureFactory = $ customerSecureFactory ;
@@ -180,7 +172,6 @@ public function __construct(
180172 $ this ->collectionProcessor = $ collectionProcessor ;
181173 $ this ->notificationStorage = $ notificationStorage ;
182174 $ this ->delegatedStorage = $ delegatedStorage ?? ObjectManager::getInstance ()->get (DelegatedStorage::class);
183- $ this ->hydrator = $ hydrator ?: ObjectManager::getInstance ()->get (HydratorInterface::class);
184175 }
185176
186177 /**
@@ -194,7 +185,6 @@ public function __construct(
194185 * @throws \Magento\Framework\Exception\LocalizedException
195186 * @SuppressWarnings(PHPMD.CyclomaticComplexity)
196187 * @SuppressWarnings(PHPMD.NPathComplexity)
197- * @SuppressWarnings(PHPMD.ExcessiveMethodLength)
198188 */
199189 public function save (CustomerInterface $ customer , $ passwordHash = null )
200190 {
@@ -203,11 +193,10 @@ public function save(CustomerInterface $customer, $passwordHash = null)
203193 $ prevCustomerData = $ prevCustomerDataArr = null ;
204194 if ($ customer ->getId ()) {
205195 $ prevCustomerData = $ this ->getById ($ customer ->getId ());
206- $ prevCustomerDataArr = $ this ->hydrator ->extract ($ prevCustomerData );
207- $ customer = $ this ->hydrator ->hydrate ($ prevCustomerData , $ customer ->__toArray ());
196+ $ prevCustomerDataArr = $ prevCustomerData ->__toArray ();
208197 }
209198 /** @var $customer \Magento\Customer\Model\Data\Customer */
210- $ customerArr = $ this -> hydrator -> extract ( $ customer );
199+ $ customerArr = $ customer -> __toArray ( );
211200 $ customer = $ this ->imageProcessor ->save (
212201 $ customer ,
213202 CustomerMetadataInterface::ENTITY_TYPE_CUSTOMER ,
0 commit comments