From 824919b537170875130ceac5e9a05cf9e87b41eb Mon Sep 17 00:00:00 2001 From: Christian Kerl Date: Thu, 29 Sep 2011 13:47:42 +0200 Subject: [PATCH] added methods to SoapServerBuilder to add TypeConverterInterface and TypeConverterCollection objects directly --- src/BeSimple/SoapServer/SoapServerBuilder.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/BeSimple/SoapServer/SoapServerBuilder.php b/src/BeSimple/SoapServer/SoapServerBuilder.php index 7536157..f2a51de 100644 --- a/src/BeSimple/SoapServer/SoapServerBuilder.php +++ b/src/BeSimple/SoapServer/SoapServerBuilder.php @@ -13,6 +13,8 @@ namespace BeSimple\SoapServer; use BeSimple\SoapCommon\Cache; +use BeSimple\SoapCommon\Converter\TypeConverterInterface; +use BeSimple\SoapCommon\Converter\TypeConverterCollection; /** * SoapServerBuilder provides a fluent interface to configure and create a SoapServer instance. @@ -257,6 +259,20 @@ class SoapServerBuilder throw new \InvalidArgumentException('The handler has to be a class name or an object!'); } + public function withTypeConverter(TypeConverterInterface $converter) + { + $this->withTypeMapping($converter->getTypeNamespace(), $converter->getTypeName(), array($converter, 'convertXmlToPhp'), array($converter, 'convertPhpToXml')); + + return $this; + } + + public function withTypeConverters(TypeConverterCollection $converters, $merge = true) + { + $this->withTypemap($converters->getTypemap(), $merge); + + return $this; + } + /** * Adds a type mapping to the typemap. *