Skip to content

Conversation

@veewee
Copy link
Contributor

@veewee veewee commented Dec 19, 2025

See #571

This is a breaking change, since it introduces a new way of configuring the code generation.
The models and contexts also changed.

Example:

return Config::create()
    ->setEngine($engine = DefaultEngineFactory::create(
        EngineOptions::defaults('infodienste.wsdl')
    ))
    ->setTypeNamespaceMap(
        \Phpro\SoapClient\CodeGenerator\Config\TypeNamespaceMap::create(new \Phpro\SoapClient\CodeGenerator\Config\Destination('src/Type', 'App\\Type'))
            ->withMapping('http://xoev.de/schemata/xzufi/2_2_0', new \Phpro\SoapClient\CodeGenerator\Config\Destination('src/Type/Xoev', 'App\\Type\\Xoev'))
            ->withMapping('http://www.opengis.net/gml/3.2', new \Phpro\SoapClient\CodeGenerator\Config\Destination('src/Type/Gml', 'App\\Type\\Gml'))
            ->withMapping('http://www.isotc211.org/2005/gmd', new \Phpro\SoapClient\CodeGenerator\Config\Destination('src/Type/Gmd', 'App\\Type\\Gmd'))
            ->withMapping('http://www.isotc211.org/2005/gmc', new \Phpro\SoapClient\CodeGenerator\Config\Destination('src/Type/Gmc', 'App\\Type\\Gmc'))
            ->withMapping('http://www.isotc211.org/2005/gco', new \Phpro\SoapClient\CodeGenerator\Config\Destination('src/Type/Gco', 'App\\Type\\Gco'))
            ->withMapping('http://www.isotc211.org/2005/gss', new \Phpro\SoapClient\CodeGenerator\Config\Destination('src/Type/Gss', 'App\\Type\\Gss'))
            ->withMapping('http://www.isotc211.org/2005/gts', new \Phpro\SoapClient\CodeGenerator\Config\Destination('src/Type/Gts', 'App\\Type\\Gts'))
            ->withMapping('http://www.w3.org/1999/xlink', new \Phpro\SoapClient\CodeGenerator\Config\Destination('src/Type/Xlink', 'App\\Type\\Xlink'))


    )
    ->setClient(new \Phpro\SoapClient\CodeGenerator\Config\ClientConfig('MyClient', new \Phpro\SoapClient\CodeGenerator\Config\Destination('src', 'App')))
    ->setClassMap(new \Phpro\SoapClient\CodeGenerator\Config\ClassMapConfig('MyClassmap', new \Phpro\SoapClient\CodeGenerator\Config\Destination('src', 'App')))

@veewee veewee marked this pull request as draft December 19, 2025 12:20
$this->addNonEmptySetter($context, 'setClientDestination', $baseDir);
$this->addNonEmptySetter($context, 'setClientName', $name.'Client');
$this->addNonEmptySetter($context, 'setClientNamespace', $namespace);
$context->addSetter('setClient', sprintf(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Todo : import namespaces + improve readability.

$context->addSetter('setTypeDestination', $baseDir.DIRECTORY_SEPARATOR.'Type');
$context->addSetter('setTypeNamespace', $namespace.'\\Type');
$context->addSetter('setTypeNamespaceMap', sprintf(
'%s::create(new %s(%s, %s))',
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

todo : pre-detect all xmlns declarations an provide a generated mapping.

{
public function __invoke(TypeCollection $allTypes): TypeCollection
{
// TODO : Optimize based on type namespace uniqueness.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO

@veewee veewee changed the title Make it possible to configure a mapping of type namespaces based on xmlns [WIP] Make it possible to configure a mapping of type namespaces based on xmlns Dec 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant