33 public $archivingDuration;
56 $attributes = array(),
57 $archivingDuration = null,
62 $this->attributes = $attributes;
63 $this->archivingDuration = $archivingDuration;
64 $this->storeOnly = $storeOnly;
75 if (isset($xmlElement->id)) $this->
id = $xmlElement->id;
76 if (isset($xmlElement->name)) $this->name = $xmlElement->name;
78 if (isset($xmlElement->attributes)) {
79 $this->attributes = array();
80 foreach ($xmlElement->attributes->children() as $xmlAttribute) {
82 if (isset($xmlAttribute->id)) $attribute[
'id'] = trim($xmlAttribute->id);
83 if (isset($xmlAttribute->name)) $attribute[
'name'] = trim($xmlAttribute->name);
85 if (isset($xmlAttribute->required)) $attribute[
'required'] = $xmlAttribute->required;
86 if (isset($xmlAttribute->archivingDuration)) $attribute[
'archivingDuration'] = $xmlAttribute->archivingDuration;
87 if (isset($xmlAttribute->storeOnly)) $attribute[
'storeOnly'] = $xmlAttribute->storeOnly;
88 array_push($this->attributes, $attribute);
101 if (isset($this->attributes)) {
102 foreach ($this->attributes as $index => $value) {
103 $attributes .=
"attribute (id=" . $value[
'id'] .
", name=" . $value[
'name'] .
", type=" . $value[
'type']->getValue() .
", required=" . (($value[
'required'] ==
true) ?
"true" :
"false") .
"), ";
105 $attributes = rtrim($attributes,
' ');
106 $attributes = rtrim($attributes,
',');
110 return "TransactionType [id=" . $this->
id .
", name=" . $this->name .
", archivingDuration=" . $this->archivingDuration .
", storeOnly=" . $this->storeOnly .
", attributes=" . $attributes .
"]";
119 $xml =
new SimpleXMLElement(
"<?xml version=\"1.0\"?><transaction_type></transaction_type>");
122 if (isset($this->
id)) $xml->addChild(
"id", $this->
id);
123 if (isset($this->name)) $xml->addChild(
"name", $this->name);
124 if (isset($this->archivingDuration)) $xml->addChild(
"archivingDuration", $this->archivingDuration);
125 if (isset($this->storeOnly)) $xml->addChild(
"storeOnly", ($this->storeOnly==
true)?
"true":
"false");
127 if (isset($this->attributes) &&
sizeof($this->attributes) > 0) {
129 $attributes = $xml->addChild(
"attributes");
130 foreach ($this->attributes as $index => $value) {
131 $field = $attributes->addChild(
"attribute");
132 $field->addChild(
"id", $value->id);
133 $field->addChild(
"name", $value->name);
134 $field->addChild(
"type", $value->type->getValue());
135 $field->addChild(
"required", ($value->required ==
true) ?
"true" :
"false");
148 $xml = $this->
toXML();
149 return $xml->asXML();
static getDataType($value)
__construct($id=null, $name=null, $attributes=array(), $archivingDuration=null, $storeOnly=false)