From ea4d031084485c79a613a72f6038124068523df7 Mon Sep 17 00:00:00 2001 From: Francis Besset Date: Wed, 27 Feb 2013 17:06:00 +0100 Subject: [PATCH] Fixed issue #29 --- ServiceBinding/RpcLiteralRequestMessageBinder.php | 10 ++++++++++ ServiceBinding/RpcLiteralResponseMessageBinder.php | 10 ++++++++++ 2 files changed, 20 insertions(+) diff --git a/ServiceBinding/RpcLiteralRequestMessageBinder.php b/ServiceBinding/RpcLiteralRequestMessageBinder.php index f3c0b99..e058547 100644 --- a/ServiceBinding/RpcLiteralRequestMessageBinder.php +++ b/ServiceBinding/RpcLiteralRequestMessageBinder.php @@ -61,6 +61,16 @@ class RpcLiteralRequestMessageBinder implements MessageBinderInterface foreach ($message->item as $complexType) { $array[] = $this->checkComplexType($phpType, $complexType); } + + // See https://github.com/BeSimple/BeSimpleSoapBundle/issues/29 + if (in_array('BeSimple\SoapCommon\Type\AbstractKeyValue', class_parents($phpType))) { + $assocArray = array(); + foreach ($array as $keyValue) { + $assocArray[$keyValue->getKey()] = $keyValue->getValue(); + } + + $array = $assocArray; + } } $message = $array; diff --git a/ServiceBinding/RpcLiteralResponseMessageBinder.php b/ServiceBinding/RpcLiteralResponseMessageBinder.php index bfb752d..dfdd509 100644 --- a/ServiceBinding/RpcLiteralResponseMessageBinder.php +++ b/ServiceBinding/RpcLiteralResponseMessageBinder.php @@ -46,6 +46,16 @@ class RpcLiteralResponseMessageBinder implements MessageBinderInterface if ($isArray) { $array = array(); + // See https://github.com/BeSimple/BeSimpleSoapBundle/issues/29 + if (is_array($message) && in_array('BeSimple\SoapCommon\Type\AbstractKeyValue', class_parents($phpType))) { + $keyValue = array(); + foreach ($message as $key => $value) { + $keyValue[] = new $phpType($key, $value); + } + + $message = $keyValue; + } + foreach ($message as $complexType) { $array[] = $this->checkComplexType($phpType, $complexType); }