39 public $archivingDuration;
64 $attributes = array(),
65 $archivingDuration = null,
71 $this->attributes = $attributes;
72 $this->archivingDuration = $archivingDuration;
73 $this->storeOnly = $storeOnly;
74 $this->description = $description;
85 if (isset($xmlElement->id)) $this->
id = $xmlElement->id;
86 if (isset($xmlElement->name)) $this->name = $xmlElement->name;
87 if (isset($xmlElement->description)) $this->description = $xmlElement->description;
89 if (isset($xmlElement->attributes)) {
90 $this->attributes = array();
91 foreach ($xmlElement->attributes->children() as $xmlAttribute) {
93 if (isset($xmlAttribute->id)) $attribute[
'id'] = trim($xmlAttribute->id);
94 if (isset($xmlAttribute->name)) $attribute[
'name'] = trim($xmlAttribute->name);
95 if (isset($xmlAttribute->description)) $attribute[
'description'] = trim($xmlAttribute->description);
97 if (isset($xmlAttribute->required)) $attribute[
'required'] = $xmlAttribute->required;
98 if (isset($xmlAttribute->archivingDuration)) $attribute[
'archivingDuration'] = $xmlAttribute->archivingDuration;
99 if (isset($xmlAttribute->storeOnly)) $attribute[
'storeOnly'] = $xmlAttribute->storeOnly;
100 array_push($this->attributes, $attribute);
113 if (isset($this->attributes)) {
114 foreach ($this->attributes as $index => $value) {
115 echo $value[
'name'].
"<br />";
116 $attributes .=
"attribute (id=" . $value[
'id'] .
", name=" . $value[
'name'] .
", description=" . ((!empty($value[
'description']))?$value[
'description']:
"") .
", type=" . $value[
'type']->getValue() .
", required=" . (($value[
'required'] ==
true) ?
"true" :
"false") .
"), ";
118 $attributes = rtrim($attributes,
' ');
119 $attributes = rtrim($attributes,
',');
123 return "TransactionType [id=" . $this->
id .
", name=" . $this->name .
", description=" . $this->description .
", archivingDuration=" . $this->archivingDuration .
", storeOnly=" . $this->storeOnly .
", attributes=" . $attributes .
"]";
132 $xml =
new SimpleXMLElement(
"<?xml version=\"1.0\"?><transaction_type></transaction_type>");
135 if (isset($this->
id)) $xml->addChild(
"id", $this->
id);
136 if (isset($this->name)) $xml->addChild(
"name", $this->name);
137 if (isset($this->name)) $xml->addChild(
"description", $this->description);
138 if (isset($this->archivingDuration)) $xml->addChild(
"archivingDuration", $this->archivingDuration);
139 if (isset($this->storeOnly)) $xml->addChild(
"storeOnly", ($this->storeOnly==
true)?
"true":
"false");
141 if (isset($this->attributes) &&
sizeof($this->attributes) > 0) {
143 $attributes = $xml->addChild(
"attributes");
144 foreach ($this->attributes as $index => $value) {
145 $field = $attributes->addChild(
"attribute");
146 $field->addChild(
"id", $value->id);
147 $field->addChild(
"name", $value->name);
148 $field->addChild(
"description", $value->description);
149 $field->addChild(
"type", $value->type->getValue());
150 $field->addChild(
"required", ($value->required ==
true) ?
"true" :
"false");
163 $xml = $this->
toXML();
164 return $xml->asXML();
static getDataType($value)
__construct($id=null, $name=null, $attributes=array(), $archivingDuration=null, $storeOnly=false, $description=null)