Skip to content

Commit

Permalink
create absent collection node
Browse files Browse the repository at this point in the history
  • Loading branch information
Björn Bösel committed Jan 11, 2017
1 parent 20de51f commit 176f195
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/JMS/Serializer/XmlDeserializationVisitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ public function visitArray($data, array $type, Context $context)
$namespace = isset($classMetadata->xmlNamespaces[''])?$classMetadata->xmlNamespaces['']:$namespace;
}

$hasNode = null !== $namespace ? isset($data->children($namespace)->$entryName) : isset($data->$entryName);

$hasNode = null !== $namespace ? isset($data->children($namespace)->$entryName) : isset($data->$entryName);
if (false === $hasNode) {
if (null === $this->result) {
return $this->result = array();
Expand Down Expand Up @@ -245,11 +245,11 @@ public function visitProperty(PropertyMetadata $metadata, $data, Context $contex
if ($metadata->xmlCollection) {
$enclosingElem = $data;
if (!$metadata->xmlCollectionInline) {
if (!isset($data->children($metadata->xmlNamespace)->$name)) {
$metadata->setValue($this->currentObject, array());
return;
if (isset($data->children($metadata->xmlNamespace)->$name)) {
$enclosingElem = $data->children($metadata->xmlNamespace)->$name;
} else {
$enclosingElem = $data->addChild($name, $metadata->xmlNamespace);
}
$enclosingElem = $data->children($metadata->xmlNamespace)->$name;
}

$this->setCurrentMetadata($metadata);
Expand Down

0 comments on commit 176f195

Please sign in to comment.