@@ -237,17 +237,6 @@ public function execute()
237
237
$ customer = $ this ->getCustomerDataObject ($ this ->session ->getCustomerId ());
238
238
$ customerCandidate = $ this ->populateNewCustomerDataObject ($ this ->_request , $ customer );
239
239
240
- $ attributeToDelete = (string )$ this ->_request ->getParam ('delete_attribute_value ' );
241
- if ($ attributeToDelete !== "" ) {
242
- $ attributesToDelete = $ this ->prepareAttributesToDelete ($ attributeToDelete );
243
- foreach ($ attributesToDelete as $ attribute ) {
244
- $ uploadedValue = $ this ->_request ->getParam ($ attribute . File::UPLOADED_FILE_SUFFIX );
245
- if ((string )$ uploadedValue === "" ) {
246
- $ this ->deleteCustomerFileAttribute ($ customerCandidate , $ attribute );
247
- }
248
- }
249
- }
250
-
251
240
try {
252
241
// whether a customer enabled change email option
253
242
$ isEmailChanged = $ this ->processChangeEmailRequest ($ customer );
@@ -484,38 +473,4 @@ private function disableAddressValidation($customer)
484
473
$ addressModel ->setShouldIgnoreValidation (true );
485
474
}
486
475
}
487
-
488
- /**
489
- * Removes file attribute from customer entity and file from filesystem
490
- *
491
- * @param CustomerInterface $customerCandidateDataObject
492
- * @param string $attributeToDelete
493
- * @return void
494
- * @throws FileSystemException
495
- */
496
- private function deleteCustomerFileAttribute (
497
- CustomerInterface $ customerCandidateDataObject ,
498
- string $ attributeToDelete
499
- ) : void {
500
- if ($ attributeToDelete !== '' ) {
501
- $ attributes = $ this ->prepareAttributesToDelete ($ attributeToDelete );
502
- foreach ($ attributes as $ attr ) {
503
- $ attributeValue = $ customerCandidateDataObject ->getCustomAttribute ($ attr );
504
- if ($ attributeValue !== null ) {
505
- if ($ attributeValue ->getValue () !== '' ) {
506
- $ mediaDirectory = $ this ->filesystem ->getDirectoryWrite (DirectoryList::MEDIA );
507
- $ fileName = $ attributeValue ->getValue ();
508
- $ path = $ mediaDirectory ->getAbsolutePath ('customer ' . $ fileName );
509
- if ($ fileName && $ mediaDirectory ->isFile ($ path )) {
510
- $ mediaDirectory ->delete ($ path );
511
- }
512
- $ customerCandidateDataObject ->setCustomAttribute (
513
- $ attr ,
514
- ''
515
- );
516
- }
517
- }
518
- }
519
- }
520
- }
521
476
}
0 commit comments