/** * Proxy to parent Mad_Support_ArrayObject#toXml, except that * we know the explicit model type. */ public function toXml($options = array()) { if (!isset($options['root'])) { $options['root'] = Mad_Support_Inflector::pluralize(get_class($this->_model)); } return parent::toXml($options); }
/** * @param Mad_Model_Serializer_Attribute */ public function addTag($attribute) { $attrName = $this->dasherize($attribute->getName()); $attrValue = $attribute->getValue(); $attrDecos = $attribute->getDecorations(empty($this->_options['skipTypes'])); $builder = $this->getBuilder(); // check if attribute values need to be further serialized if (is_array($attrValue)) { $options = array_merge($this->_options, array('root' => $attrName)); $ao = new Mad_Support_ArrayObject($attrValue); $ao->toXml($options); } else { $builder->tag($attrName, $attrValue, $attrDecos); } }