Example #1
0
 public function mapProperty($name, $value)
 {
     echo "\n";
     if ($name == 'Product_Details') {
         $result = '<FL val="' . str_replace(['_', 'N36', 'E5F', '&'], [' ', '$', '_', 'and'], $name) . '">';
         $index = 1;
         foreach ($value as $product) {
             $result .= '<product no="' . $index++ . '">';
             $result .= $product->mapProperties();
             $result .= '</product>';
         }
         $result .= '</FL>';
         return $result;
     } else {
         return parent::mapProperty($name, $value);
     }
 }
Example #2
0
 /**
 * Convert an entity into XML
 * 
 * @param Element $entity Element with values on fields setted
 * @return string XML created
 * @todo
 		- Add iteration for multiples entities and creation of xml with collection
 */
 public function mapEntity(Element $entity)
 {
     if (empty($this->module)) {
         throw new \Exception("Invalid module, it must be setted before map the entity", 1);
     }
     $no = 1;
     $xml = '<' . $this->module . '>';
     $xml .= '<row no="' . $no . '">';
     $xml .= $entity->mapProperties();
     $xml .= '</row>';
     $xml .= '</' . $this->module . '>';
     return $xml;
 }