diff --git a/src/Sylius/Bundle/AdminApiBundle/Form/ChoiceList/LazyCustomerLoader.php b/src/Sylius/Bundle/AdminApiBundle/Form/ChoiceList/LazyCustomerLoader.php index b2f6cff11417..e1cb6f42ba3a 100644 --- a/src/Sylius/Bundle/AdminApiBundle/Form/ChoiceList/LazyCustomerLoader.php +++ b/src/Sylius/Bundle/AdminApiBundle/Form/ChoiceList/LazyCustomerLoader.php @@ -61,7 +61,13 @@ public function loadChoicesForValues(array $values, $value = null) public function loadValuesForChoices(array $choices, $value = null) { $mapCustomerToEmail = function($customer){ + if($customer == null){ + return null; + } + return $customer->getEmail(); }; + + return array_map($mapCustomerToEmail, $choices); } } \ No newline at end of file