Fix compatibility with SF4 + Other fixes

This commit is contained in:
Gianluigi 'cocciagialla' Mammarella 2019-04-02 14:58:41 +02:00
parent 873dc0ae08
commit 2d36e5f060
7 changed files with 31 additions and 27 deletions

View File

@ -1,3 +1,4 @@
vendor/
composer.lock
phpunit.xml
.idea/

View File

@ -15,12 +15,14 @@ namespace BeSimple\SoapBundle\Controller;
use BeSimple\SoapBundle\Handler\ExceptionHandler;
use BeSimple\SoapBundle\Soap\SoapRequest;
use BeSimple\SoapBundle\Soap\SoapResponse;
use BeSimple\SoapBundle\WebServiceContext;
use BeSimple\SoapServer\SoapServerBuilder;
use Symfony\Component\DependencyInjection\ContainerAwareInterface;
use Symfony\Component\DependencyInjection\ContainerAwareTrait;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\FlattenException;
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
@ -31,11 +33,7 @@ use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
*/
class SoapWebServiceController implements ContainerAwareInterface
{
/**
* @var ContainerInterface
*/
protected $container;
use ContainerAwareTrait;
/**
* @var \SoapServer
@ -62,19 +60,12 @@ class SoapWebServiceController implements ContainerAwareInterface
*/
private $headers = array();
/**
* {@inheritDoc}
*/
public function setContainer(ContainerInterface $container = null)
{
$this->container = $container;
}
/**
* @return \BeSimple\SoapBundle\Soap\SoapResponse
*/
public function callAction($webservice)
{
/** @var WebServiceContext $webServiceContext */
$webServiceContext = $this->getWebServiceContext($webservice);
$this->serviceBinder = $webServiceContext->getServiceBinder();
@ -98,7 +89,7 @@ class SoapWebServiceController implements ContainerAwareInterface
}
/**
* @return Symfony\Component\HttpFoundation\Response
* @return Response
*/
public function definitionAction($webservice)
{
@ -110,7 +101,8 @@ class SoapWebServiceController implements ContainerAwareInterface
)
));
$request = $this->container->get('request');
/** @var Request $request */
$request = $this->container->get('request_stack')->getCurrentRequest();
$query = $request->query;
if ($query->has('wsdl') || $query->has('WSDL')) {
$request->setRequestFormat('wsdl');
@ -136,9 +128,9 @@ class SoapWebServiceController implements ContainerAwareInterface
throw new \LogicException(sprintf('The parameter "%s" is required in Request::$query parameter bag to generate the SoapFault.', '_besimple_soap_webservice'), null, $e);
}
$view = 'TwigBundle:Exception:'.($this->container->get('kernel')->isDebug() ? 'exception' : 'error').'.txt.twig';
$view = '@Twig/Exception/'.($this->container->get('kernel')->isDebug() ? 'exception' : 'error').'.txt.twig';
$code = $exception->getStatusCode();
$details = $this->container->get('templating')->render($view, array(
$details = $this->container->get('twig')->render($view, array(
'status_code' => $code,
'status_text' => isset(Response::$statusTexts[$code]) ? Response::$statusTexts[$code] : '',
'exception' => $exception,

View File

@ -177,6 +177,7 @@ class BeSimpleSoapExtension extends Extension
$options = $container
->getDefinition('besimple.soap.context.'.$bindingSuffix)
->setPublic(true)
->getArgument(2);
$definition->replaceArgument(2, array_merge($options, $config));

View File

@ -13,8 +13,8 @@
namespace BeSimple\SoapBundle\Handler;
use BeSimple\SoapServer\Exception\ReceiverSoapFault;
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\FlattenException;
/**
* @author Francis Besset <francis.besset@gmail.com>

View File

@ -19,7 +19,7 @@
</parameters>
<services>
<service id="besimple.soap.response" class="%besimple.soap.response.class%" />
<service id="besimple.soap.response" class="%besimple.soap.response.class%" public="true" />
<service id="besimple.soap.response.listener" class="%besimple.soap.response.listener.class%">
<tag name="kernel.event_listener" event="kernel.view" method="onKernelView" />

View File

@ -35,6 +35,11 @@ class ComplexType extends Configuration
return $this->isNillable;
}
public function getIsNillable()
{
return $this->isNillable;
}
public function setName($name)
{
$this->name = $name;
@ -50,6 +55,11 @@ class ComplexType extends Configuration
$this->isNillable = (bool) $isNillable;
}
public function setIsNillable($isNillable)
{
$this->isNillable = (bool) $isNillable;
}
/**
* @return bool
*/
@ -66,7 +76,7 @@ class ComplexType extends Configuration
public function setIsAttribute($isAttribute)
{
$this->isAttribute = $isAttribute;
return $this;
}
@ -74,4 +84,4 @@ class ComplexType extends Configuration
{
return 'complextype';
}
}
}

View File

@ -238,7 +238,7 @@ class Dumper
$complexType = $this->document->createElement(static::XSD_NS.':complexType');
$complexType->setAttribute('name', $type->getXmlType());
$all = $this->document->createElement(static::XSD_NS.':'.'sequence');
$all = $this->document->createElement(static::XSD_NS.':'.($type instanceof ArrayOfType ? 'sequence' : 'all'));
$complexType->appendChild($all);
foreach ($type->all() as $child) {
@ -258,10 +258,10 @@ class Dumper
$name = $childType->getName();
}
if (0 === strpos($name, 'ArrayOf')) {
$isArray = true;
$name = lcfirst(substr($name, 7));
}
// if (0 === strpos($name, 'ArrayOf')) {
// $isArray = true;
// $name = lcfirst(substr($name, 7));
// }
$element->setAttribute('type', static::TYPES_NS.':'.$name);
} else {