-
-
Notifications
You must be signed in to change notification settings - Fork 585
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
Generate namespaced element on XmlList entries #301
Conversation
@skler Are you still working on this? |
@schmittjoh Tests passes on my env (PHPUnit 3.7.28 and PHP 5.5.12) |
} else { | ||
$element = $this->document->createElement($elementName); | ||
$classMetadata = $this->objectMetadataStack->top(); | ||
$defaultNamespace = isset($classMetadata->xmlNamespaces[''])?$classMetadata->xmlNamespaces['']:null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about adding a method for this to the metadata class, we seem to repeat this in a couple of places.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if an implementation as:
private function getClassDefaultNamespace(ClassMetadata $metadata)
{
return (isset($metadata->xmlNamespaces[''])?$metadata->xmlNamespaces['']:null);
}
would be enough.
put $classMetadata = $this->objectMetadataStack->top();
inside is not possible...
@goetas No, but if you need support I'm here |
News on this? |
What's holding this up? |
+1 Is there a workaround for this in the meantime? My issue is that the node has a prefix and won't deserialize without specifying it. |
@schmittjoh could be integrated this? If you like other fixes tell us. |
+1 My current workaround is to remove the namespace prefix before sending it to deserialize. |
rebased some commits to have a clean commit list |
How it's going? I need this functionality 😢 |
@Tobur you can try to use my fork (see here https://github.com/goetas/xsd2php how to use it into your composer.json) |
+1, reluctant to use a fork when a PR seems ready to go... |
Looks like this needs a rebase. Would love an update. |
+1 |
Hey, what's up here? |
I also want to leave my +1 on this one here as I just ran into exactly the same wall, array element has to be in a namespace. |
+1 |
2 similar comments
+1 |
+1 |
+1, merge? |
+1 for a merge. |
@schmittjoh any chance to see this merged? i can rebase it again... |
+1 for a merge, please let us know if we can help in any way to get this in. |
+1 for a merge. |
+1 merge |
Rebased again. |
Test failures are unrelated and currently on master https://travis-ci.org/schmittjoh/serializer/jobs/126569375 |
@@ -35,6 +35,7 @@ class PropertyMetadata extends BasePropertyMetadata | |||
public $xmlCollection = false; | |||
public $xmlCollectionInline = false; | |||
public $xmlEntryName; | |||
public $xmlEntryNamespace; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should add that to serialize
/ unserialize
a bit further down, no?
Sorry for the wait, looks good, can you check the comment above, so we can merge this? |
done |
We should probably have an exception if someone deserializes an old version. Could you check the number of elements in |
done |
Thanks! |
#237 can be closed, dunno why I'm not between the contributors :( but happy to see this merged! |
@skler my bad, after almost two years of pending PR yesterday i have rebased it and for some issues with my git repo i have squashed all previous commits into one... sorry, my bad |
@schmittjoh would this justify a new minor release? |
Things done with this patch:
@XmlNamespace(uri="http://example.com/namespace")
acts as default namespaceXmlDeserializationVisitor
SimpleXMLElement::children
method$objectMetadataStack
to access class metadata from a propertyXmlSerializationVisitor
createElement
andsetAttributeOnNode
methods