33 public $archivingDuration;
50 $attributes = array(),
51 $archivingDuration = null)
55 $this->attributes = $attributes;
56 $this->archivingDuration = $archivingDuration;
67 if (isset($xmlElement->id)) $this->
id = $xmlElement->id;
68 if (isset($xmlElement->name)) $this->name = $xmlElement->name;
70 if (isset($xmlElement->attributes)) {
71 $this->attributes = array();
72 foreach ($xmlElement->attributes->children() as $xmlAttribute) {
74 if (isset($xmlAttribute->id)) $attribute[
'id'] = trim($xmlAttribute->id);
75 if (isset($xmlAttribute->name)) $attribute[
'name'] = trim($xmlAttribute->name);
77 if (isset($xmlAttribute->required)) $attribute[
'required'] = $xmlAttribute->required;
78 if (isset($xmlAttribute->archivingDuration)) $attribute[
'archivingDuration'] = $xmlAttribute->archivingDuration;
79 array_push($this->attributes, $attribute);
92 if (isset($this->attributes)) {
93 foreach ($this->attributes as $index => $value) {
94 $attributes .=
"attribute (id=" . $value[
'id'] .
", name=" . $value[
'name'] .
", type=" . $value[
'type']->getValue() .
", required=" . (($value[
'required'] ==
true) ?
"true" :
"false") .
"), ";
96 $attributes = rtrim($attributes,
' ');
97 $attributes = rtrim($attributes,
',');
101 return "TransactionType [id=" . $this->
id .
", name=" . $this->name .
", archivingDuration=" . $this->archivingDuration .
", attributes=" . $attributes .
"]";
110 $xml =
new SimpleXMLElement(
"<?xml version=\"1.0\"?><transaction_type></transaction_type>");
113 if (isset($this->
id)) $xml->addChild(
"id", $this->
id);
114 if (isset($this->name)) $xml->addChild(
"name", $this->name);
115 if (isset($this->archivingDuration)) $xml->addChild(
"archivingDuration", $this->archivingDuration);
117 if (isset($this->attributes) &&
sizeof($this->attributes) > 0) {
119 $attributes = $xml->addChild(
"attributes");
120 foreach ($this->attributes as $index => $value) {
121 $field = $attributes->addChild(
"attribute");
122 $field->addChild(
"id", $value->id);
123 $field->addChild(
"name", $value->name);
124 $field->addChild(
"type", $value->type->getValue());
125 $field->addChild(
"required", ($value->required ==
true) ?
"true" :
"false");
138 $xml = $this->
toXML();
139 return $xml->asXML();
static getDataType($value)
__construct($id=null, $name=null, $attributes=array(), $archivingDuration=null)