示例#1
0
 /** 
  * 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);
 }
示例#2
0
文件: Xml.php 项目: lerre/framework
 /**
  * @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);
     }
 }