-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathDocument.php
More file actions
200 lines (200 loc) · 7.32 KB
/
Document.php
File metadata and controls
200 lines (200 loc) · 7.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
<?php
/**
* @version $Id: Document.php 115 2013-11-27 17:43:09Z slavb $
*/
/**
* Документ электронного каталога
* @xmlns urn:ru:ilb:meta:TestApp:Document
* @xmlname Document
* @codegen true
*/
class TestApp_Document extends Adaptor_XMLBase implements Adaptor_Array {
/**
* Идентификатор
* Пример указания имени sql-отображения (на самом деле если имя поля в sql совпадает с именем свойства, sqlname не нужно)
* @sqlname objectId
* Пример указания направления sql-отображения. Для того чтобы свойство не
* оторажалось в sql можно указать sqlio=none
* @sqlio inout
* @var string
*/
private $objectId;
/**
* Дата создания
*
* @var Basictypes_DateTime
*/
private $createDate;
/**
* Создал
*
* @var string
*/
private $createUid;
/**
* Дата модификации
*
* @var Basictypes_DateTime
*/
private $modifyDate;
/**
* Изменил
*
* @var string
*/
private $modifyUid;
/**
* Дата удаления
*
* @var Basictypes_DateTime
*/
private $deleteDate;
/**
* Удалил
*
* @var string
*/
private $deleteUid;
/**
* Удален
*
* @var Basictypes_Boolean
*/
private $deleted;
/**
* Идентификатор раздела
*
* @var string
*/
private $containerId;
/**
* Тип объекта контейнера
*
* @var string
*/
private $containerType;
/**
* Раздел
*
* @var string
*/
private $chapterPath;
/**
* Наименование
*
* @var string
*/
private $displayName;
/**
* Описание
*
* @var string
*/
private $description;
/**
* Ключевые слова
*
* @var string
*/
private $keywords;
/**
* Дата документа
*
* @var Basictypes_Date
*/
private $docDate;
/**
* Ключ
*
* @var string
*/
private $keyId;
/**
* Вывод в XMLWriter
* @codegen true
* @param XMLWriter $xw
* @param string $xmlname Имя корневого узла
* @param int $mode
*/
public function toXmlWriter(XMLWriter &$xw,$xmlname=NULL,$xmlns=NULL,$mode=Adaptor_XML::ELEMENT){
$xmlname=$xmlname?$xmlname:"Document";
$xmlns=$xmlns?$xmlns:"urn:ru:ilb:meta:TestApp:Document";
if ($mode&Adaptor_XML::STARTELEMENT) $xw->startElementNS(NULL,$xmlname,$xmlns);
if($this->objectId!==NULL) {$xw->writeElement("objectId",$this->objectId);}
if($this->createDate!==NULL) {$xw->writeElement("createDate",$this->createDate->LogicalToXSD());}
if($this->createUid!==NULL) {$xw->writeElement("createUid",$this->createUid);}
if($this->modifyDate!==NULL) {$xw->writeElement("modifyDate",$this->modifyDate->LogicalToXSD());}
if($this->modifyUid!==NULL) {$xw->writeElement("modifyUid",$this->modifyUid);}
if($this->deleteDate!==NULL) {$xw->writeElement("deleteDate",$this->deleteDate->LogicalToXSD());}
if($this->deleteUid!==NULL) {$xw->writeElement("deleteUid",$this->deleteUid);}
if($this->deleted!==NULL) {$xw->writeElement("deleted",$this->deleted->__toString());}
if($this->containerId!==NULL) {$xw->writeElement("containerId",$this->containerId);}
if($this->containerType!==NULL) {$xw->writeElement("containerType",$this->containerType);}
if($this->chapterPath!==NULL) {$xw->writeElement("chapterPath",$this->chapterPath);}
if($this->displayName!==NULL) {$xw->writeElement("displayName",$this->displayName);}
if($this->description!==NULL) {$xw->writeElement("description",$this->description);}
if($this->keywords!==NULL) {$xw->writeElement("keywords",$this->keywords);}
if($this->docDate!==NULL) {$xw->writeElement("docDate",$this->docDate->LogicalToXSD());}
if($this->keyId!==NULL) {$xw->writeElement("keyId",$this->keyId);}
if ($mode&Adaptor_XML::ENDELEMENT) $xw->endElement();
}
/**
* Чтение из XMLReader
* @codegen true
* @param XMLReader $xr
*/
public function fromXmlReader(XMLReader &$xr){
while($xr->nodeType!=XMLReader::ELEMENT) $xr->read();
$root=$xr->localName;
if($xr->isEmptyElement) return $this;
while($xr->read()){
if($xr->nodeType==XMLReader::ELEMENT) {
$xsinil=$xr->getAttributeNs("nil","http://www.w3.org/2001/XMLSchema-instance")=="true";
switch($xr->localName){
case "objectId": $this->objectId=$xsinil?NULL:$xr->readString(); break;
case "createDate": $this->createDate=$xsinil?NULL:new Basictypes_DateTime($xr->readString(),Adaptor_DataType::XSD); break;
case "createUid": $this->createUid=$xsinil?NULL:$xr->readString(); break;
case "modifyDate": $this->modifyDate=$xsinil?NULL:new Basictypes_DateTime($xr->readString(),Adaptor_DataType::XSD); break;
case "modifyUid": $this->modifyUid=$xsinil?NULL:$xr->readString(); break;
case "deleteDate": $this->deleteDate=$xsinil?NULL:new Basictypes_DateTime($xr->readString(),Adaptor_DataType::XSD); break;
case "deleteUid": $this->deleteUid=$xsinil?NULL:$xr->readString(); break;
case "deleted": $this->deleted=$xsinil?NULL:new Basictypes_Boolean($xr->readString()); break;
case "containerId": $this->containerId=$xsinil?NULL:$xr->readString(); break;
case "containerType": $this->containerType=$xsinil?NULL:$xr->readString(); break;
case "chapterPath": $this->chapterPath=$xsinil?NULL:$xr->readString(); break;
case "displayName": $this->displayName=$xsinil?NULL:$xr->readString(); break;
case "description": $this->description=$xsinil?NULL:$xr->readString(); break;
case "keywords": $this->keywords=$xsinil?NULL:$xr->readString(); break;
case "docDate": $this->docDate=$xsinil?NULL:new Basictypes_Date($xr->readString(),Adaptor_DataType::XSD); break;
case "keyId": $this->keyId=$xsinil?NULL:$xr->readString(); break;
}
}elseif($xr->nodeType==XMLReader::END_ELEMENT&&$root==$xr->localName){
return;
}
}
return $this;
}
/**
* Для настройки sql отобажения у свойства можно указывать параметры @sqlname, @sqlio
* @codegen true
*/
public function fromArray($row,$mode=Adaptor_DataType::XSD){
if(isset($row["objectId"])) $this->objectId=$row["objectId"];
if(isset($row["createDate"])) $this->createDate=new Basictypes_DateTime($row["createDate"],$mode);
if(isset($row["createUid"])) $this->createUid=$row["createUid"];
if(isset($row["modifyDate"])) $this->modifyDate=new Basictypes_DateTime($row["modifyDate"],$mode);
if(isset($row["modifyUid"])) $this->modifyUid=$row["modifyUid"];
if(isset($row["deleteDate"])) $this->deleteDate=new Basictypes_DateTime($row["deleteDate"],$mode);
if(isset($row["deleteUid"])) $this->deleteUid=$row["deleteUid"];
if(isset($row["deleted"])) $this->deleted=new Basictypes_Boolean($row["deleted"]);
if(isset($row["containerId"])) $this->containerId=$row["containerId"];
if(isset($row["containerType"])) $this->containerType=$row["containerType"];
if(isset($row["chapterPath"])) $this->chapterPath=$row["chapterPath"];
if(isset($row["displayName"])) $this->displayName=$row["displayName"];
if(isset($row["description"])) $this->description=$row["description"];
if(isset($row["keywords"])) $this->keywords=$row["keywords"];
if(isset($row["docDate"])) $this->docDate=new Basictypes_Date($row["docDate"],$mode);
if(isset($row["keyId"])) $this->keyId=$row["keyId"];
return $this;
}
}