Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

\GoetasWebservices\Xsd\XsdToPhp\Php\ClassGenerator should be extendable #105

Open
e59 opened this issue Jan 27, 2020 · 4 comments
Open

\GoetasWebservices\Xsd\XsdToPhp\Php\ClassGenerator should be extendable #105

e59 opened this issue Jan 27, 2020 · 4 comments

Comments

@e59
Copy link

e59 commented Jan 27, 2020

Sometimes generated class code needs to be slightly changed.

Currently, the only option is to copy the whole class to another place.

You also need to extend the original one because there is no interface and \GoetasWebservices\Xsd\XsdToPhp\Writer\PHPWriter, for example, expects an instance of \GoetasWebservices\Xsd\XsdToPhp\Php\ClassGenerator.

I'd gladly provide a PR for this!

@goetas
Copy link
Member

goetas commented Jan 27, 2020

This could be an interesting feature. Which approach would you like to use to do so?

@e59
Copy link
Author

e59 commented Jan 27, 2020

I'd create ClassGeneratorInterface and use it everywhere ClassGenerator is expected, and turn ClassGenerator's currently private methods to protected.

@goetas
Copy link
Member

goetas commented Jan 29, 2020

but this will just make it possible for you to hack the current class generator, i'm more curious on which implementation do you plan to have

@e59
Copy link
Author

e59 commented Jan 29, 2020

I've implemented a Doctrine annotation generator, but I need to make a few simple adjustments to the generated classes (i.e. nullable parameters, adding collection/ embeddable initialization to constructors, changing setter/ getter schemes for collections etc).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants