/** * Parse arrays from a SimpleXml node * and set them to the given object * * @param SimpleXmlElement $xml * @param ClassMetadata $metadata * @param stdClass $obj */ protected function parseLists(\SimpleXmlElement $xml, ClassMetadata $metadata, $obj) { foreach ($metadata->getLists() as $nodeName => $info) { $property = $info[0]; $wrapperNode = $info[1]; $listMetadata = $info[2]; $tempList = array(); if (!is_null($wrapperNode)) { if (isset($xml->{$wrapperNode})) { foreach ($xml->{$wrapperNode}->{$nodeName} as $item) { if (!is_null($listMetadata)) { $tempObj = $this->parseObject($item, $listMetadata); $tempList[] = $tempObj; } else { $tempList[] = (string) $item; } } } } else { foreach ($xml->{$nodeName} as $item) { $tempObj = $this->parseObject($item, $listMetadata); $tempList[] = $tempObj; } } $setter = 'set' . ucfirst($property); $obj->{$setter}($tempList); } }