function __construct($query) { parent::__construct(); while ($type = $query->hash()) { $type_node = $this->attach("type"); $type_node->appendChild($this->attach("id", $type['id'])); $type_node->appendChild($this->attach("name", $type['type'])); $type_node->appendChild($this->attach("label", $type['label'])); $this->append($type_node); } }