Skip to content

Commit

Permalink
Merge pull request #3288 from joshuapease/address-migration-fullname-fix
Browse files Browse the repository at this point in the history
Fix #3278. Migrate address fullName in `commerce/upgrade`
  • Loading branch information
lukeholder authored Oct 12, 2023
2 parents 8316643 + c05bbb2 commit b6862ae
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/console/controllers/UpgradeController.php
Original file line number Diff line number Diff line change
Expand Up @@ -966,9 +966,13 @@ private function _createAddress($data): Address
$address->locality = $data['city'];
$address->dependentLocality = '';

if ($data['firstName'] || $data['lastName']) {
if ($data['fullName'] || $data['firstName'] || $data['lastName']) {
$this->_ensureAddressField(new FullNameField());
$address->fullName = implode(' ', array_filter([$data['firstName'], $data['lastName']]));
if ($data['fullName']) {
$address->fullName = $data['fullName'];
} else {
$address->fullName = implode(' ', array_filter([$data['firstName'], $data['lastName']]));
}
}

if ($data['businessName']) {
Expand Down

0 comments on commit b6862ae

Please sign in to comment.