-
-
Notifications
You must be signed in to change notification settings - Fork 88
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
Make simplifying lists of simple elements optional #24
Comments
What about |
I guess that's an option, but this would mean I have to edit all of the generated metadata. And it would still never use the available Do you know if it's possible to make not skipping empty lists the default in the serializer? |
metadata are meant be be overwritten each time. are you editing them manually?
isn't the only the propose of this element to have tue list element present in the serialized XML? if you manage to do it via
not possible for now |
I'm not editing the metadata, that's actually exactly what I'm trying to avoid. And yes, currently the only purpose of the element is to have it present in the serialized XML. That, and it feels like it makes "sense" in some cases to use the element instead of a plain array. |
Actually, I realise that since the ElementList has a implicit Maybe it's better to focus on that. |
yes! |
I will look into that and create a seperate issue / PR for it. I still feel like this option has it's use cases so I'll leave the branch for now. |
@jeroenvandergeer is this solved by #27 ? |
It's not really the same thing, but it solves the same problem for me. I think this can be closed. |
Whenever I have an element without any attributes that is a list of elements of only 1 type, the generator simplifies this into an array of that nested element. This makes sense, but in some cases I need the list element to be present in the serialized XML, even if it's empty.
An empty array won't be serialized, but an empty element will. I suggest making the "simplifying" of this type of list optional.
I'm not entirely sure how to describe this properly, so let's do it by example.
Given this schema:
The current output would be (simplified):
While in some cases I need this to be:
The same goes for the generated PHP code. The "ElementListAType" class is already always generated, but
MainElement::setElementList()
expects the array, and not the object.I propose to add a configuration option that enables or disables this "simplifying", with the default still being enabled. I'm already working on a PR for this and will link it shortly.
The text was updated successfully, but these errors were encountered: