mirror of
https://github.com/Sylius/Sylius.git
synced 2026-07-14 09:02:12 +00:00
Update src/Sylius/Bundle/CoreBundle/Form/Type/Checkout/AddressType.php
Co-authored-by: Victor Vasiloi <victor.vasiloi@gmail.com>
This commit is contained in:
parent
66231b4ac2
commit
282d035167
1 changed files with 4 additions and 5 deletions
|
|
@ -144,16 +144,15 @@ final class AddressType extends AbstractResourceType
|
|||
|
||||
$event->setData($orderData);
|
||||
})
|
||||
->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use ($options): void {
|
||||
->addEventListener(FormEvents::PRE_SUBMIT, static function (FormEvent $event): void {
|
||||
$orderData = $event->getData();
|
||||
$form = $event->getForm();
|
||||
|
||||
if ($options['customer'] instanceof CustomerInterface && array_key_exists('customer', $orderData)) {
|
||||
if (array_key_exists('customer', $orderData) && !$form->has('customer')) {
|
||||
// Logged-in user try to submit customer while reloading page after login
|
||||
unset($orderData['customer']);
|
||||
$event->getForm()->remove('customer');
|
||||
$event->setData($orderData);
|
||||
}
|
||||
|
||||
$event->setData($orderData);
|
||||
})
|
||||
;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue