xsd2php icon indicating copy to clipboard operation
xsd2php copied to clipboard

Allow xsd:enumeration

Open ryross opened this issue 9 years ago • 7 comments

I wanted to get values from xsd:enumeration elements in my project and I saw that @demonkoryu had done work to add that feature. This repo has been updated a bit since @demonkoryu forked and added that feature so I took the liberty of merging the changes in, and added a feature to allow numeric constants, and an empty string constant.

Thoughts?

ryross avatar Sep 23 '16 18:09 ryross

For the record, here's the issue where I found out about the fork: #35

And here's the fork: https://github.com/rtsde/xsd2php

ryross avatar Sep 23 '16 18:09 ryross

Tests are failing

goetas avatar Sep 24 '16 05:09 goetas

I wonder how the test may fail, in the end, this is simply the second PHP 5.5 build with prefer lowest and it can't call a method which should be available in Zend ClassGenerator. The test SHOULD pass unless composer pulled a broken version of Zend framework

discordier avatar Sep 28 '16 12:09 discordier

add constant was added in 2.4. the minimum is 2.3 at the moment

goetas avatar Sep 28 '16 13:09 goetas

I see, the prefer-lowest is the culprit

discordier avatar Oct 07 '16 08:10 discordier

@goetas So what is the way to go now? Wrap the addConstant with if (method_exists()) or bump the min req?

discordier avatar Oct 21 '16 16:10 discordier

In previous version of the library i had this feature, but i have removed it (and added) many times. So at the moment I'm not propense to accept this PR.

Talking for my self, I found out that having constants does not provide a real advantage, and there are so many edge cases that can not be handled. Plus there is not a real way to enforce PHP to use constants, instead of hardcoded strings.. (maybe value objects?) At the end, in some of the latest iterations i have decided simply to not implement it. (unless someone proposes a really good solution obviously).

Keeping this open anyway. Maybe a great solution will pop up one day :)

Ah, as it stands in the readme, I'm moving the development to https://github.com/goetas-webservices/xsd2php

goetas avatar Oct 22 '16 21:10 goetas