Skip to content

Commit

Permalink
Merge pull request #3 from rvdbogerd/rvdbogerd/doctrine-inflector-upg…
Browse files Browse the repository at this point in the history
…rade

Fix issue with outdated doctrine inflector usage
  • Loading branch information
goetas committed Jan 4, 2023
2 parents d363a53 + 14853cb commit 4ceeb56
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@
"ext-simplexml": "*",
"doctrine/instantiator": "^1.0.3",
"goetas-webservices/xsd2php-runtime": "^0.2.11",
"jms/serializer": "^3.0"
"jms/serializer": "^3.0",
"doctrine/inflector": "^2.0"
},
"autoload": {
"psr-4": {
Expand Down
17 changes: 12 additions & 5 deletions src/Generator/MetadataGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@

namespace GoetasWebservices\SoapServices\Metadata\Generator;

use Doctrine\Common\Inflector\Inflector;
use Doctrine\Inflector\Inflector;
use Doctrine\Inflector\InflectorFactory;
use GoetasWebservices\XML\SOAPReader\Soap\Operation;
use GoetasWebservices\XML\SOAPReader\Soap\OperationMessage;
use GoetasWebservices\XML\SOAPReader\Soap\Service;
Expand Down Expand Up @@ -46,6 +47,11 @@ class MetadataGenerator implements MetadataGeneratorInterface
* @var bool
*/
private $unwrap = false;
/**
* @var Inflector
*/
private $inflector;


/**
* @param array $namespaces
Expand All @@ -54,6 +60,7 @@ public function __construct(NamingStrategy $namingStrategy, array $namespaces)
{
$this->namespaces = $namespaces;
$this->namingStrategy = $namingStrategy;
$this->inflector = InflectorFactory::create()->build();
}

public function addAlternativeEndpoint(string $service, string $port, string $endPoint): void
Expand Down Expand Up @@ -112,7 +119,7 @@ protected function generateOperation(Operation $soapOperation, Service $service)
'style' => $soapOperation->getStyle(),
'version' => $service->getVersion(),
'name' => $soapOperation->getOperation()->getName(),
'method' => Inflector::camelize($soapOperation->getOperation()->getName()),
'method' => $this->inflector->camelize($soapOperation->getOperation()->getName()),
'input' => $this->generateInOut($soapOperation, $soapOperation->getInput(), $soapOperation->getOperation()->getPortTypeOperation()->getInput(), 'Input', $service),
'output' => $this->generateInOut($soapOperation, $soapOperation->getOutput(), $soapOperation->getOperation()->getPortTypeOperation()->getOutput(), 'Output', $service),
'fault' => [],
Expand All @@ -130,15 +137,15 @@ protected function generateInOut(Operation $operation, OperationMessage $operati
$operation = [
'message_fqcn' => $ns
. $this->baseNs[$service->getVersion()]['messages'] . '\\'
. Inflector::classify($operationMessage->getMessage()->getOperation()->getName())
. $this->inflector->classify($operationMessage->getMessage()->getOperation()->getName())
. $direction,
'headers_fqcn' => $ns
. $this->baseNs[$service->getVersion()]['headers'] . '\\'
. Inflector::classify($operationMessage->getMessage()->getOperation()->getName())
. $this->inflector->classify($operationMessage->getMessage()->getOperation()->getName())
. $direction,
'part_fqcn' => $ns
. $this->baseNs[$service->getVersion()]['parts'] . '\\'
. Inflector::classify($operationMessage->getMessage()->getOperation()->getName())
. $this->inflector->classify($operationMessage->getMessage()->getOperation()->getName())
. $direction,
'parts' => $this->getParts($param->getMessage()->getParts()),
];
Expand Down

0 comments on commit 4ceeb56

Please sign in to comment.