public function testShouldHasManyArrayElementsShouldIncludeTypeWhenDifferentFromGuessedValue() { $xml = $this->companies('maintainable')->toXml(array('include' => 'Employees', 'indent' => 2)); $this->assertNotNull(Mad_Support_ArrayObject::fromXml($xml)); $this->assertContains('<employees type="array">', $xml); $this->assertContains('<employee type="User">', $xml); $this->assertContains('<employee type="Client">', $xml); }
/** * Convert XML to an Mad_Model record * * @see Mad_Model_Base::toXml() * @param string $xml * @return Mad_Model_Base */ public function fromXml($xml) { $converted = Mad_Support_ArrayObject::fromXml($xml); $values = array_values($converted); $attributes = $values[0]; $this->setAttributes($attributes); return $this; }
/** * Parse XML into request params for active resource style requests * @return array */ protected function _parseFormattedRequestParameters() { if ($this->getContentLength() == 0) { return array(); } $mimeType = $this->getContentType(); if ($mimeType === null) { return array(); } // parse xml into params if ($mimeType->symbol == 'xml') { $body = $this->getBody(); return empty($body) ? array() : Mad_Support_ArrayObject::fromXml($body); // nothing else supported now } else { return array(); } }