<?php
 class InfoModuleItemVO implements MotoDomObjectInterface { public $id; public $order; public $properties; public function __construct(DOMNode $parent = null) { if (!empty($parent)) { $this->loadDomElement($parent); } } public function loadDomElement(DOMNode $parent) { $this->id = (integer) $parent->getAttribute('id'); $this->order = (integer) $parent->getAttribute('order'); $this->properties = PropertyVO::findAll($parent); return $this; } public function saveDomElement(DOMNode $parent) { $parent->setAttribute('id', (integer) $this->id); $parent->setAttribute('order', (integer) $this->order); $propertiesNode = $parent->appendChild(new DOMElement('properties')); foreach ($this->properties as $property) { $property->saveDomElement($propertiesNode->appendChild(new DOMElement('item'))); } return $parent; } public function remove() { if (!is_null($this->_node)) { $this->_node->parentNode->removeChild($this->_node); $this->_node = null; } return true; } public static function findById($id, DOMNode $context) { return MotoXML::findOneByXPath(".//data/item[@id='{$id}']", $context, get_class()); } public static function findAll(DOMNode $context) { return MotoXML::findByXPath(".//data/item", $context, get_class()); } } ?>