1 | <?php |
||
26 | class Record extends Model |
||
27 | { |
||
28 | protected $propNameMap = [ |
||
29 | 'change_type' => 'changeType', |
||
30 | 'collection_id' => 'collectionId', |
||
31 | 'record_id' => 'recordId' |
||
32 | ]; |
||
33 | |||
34 | protected $mappingClasses = [ |
||
35 | 'changes' => 'Yandex\DataSync\Models\Database\Delta\RecordFields', |
||
36 | 'fields' => 'Yandex\DataSync\Models\Database\Delta\RecordFields', |
||
37 | ]; |
||
38 | |||
39 | /** |
||
40 | * Adding a new record. |
||
41 | * (only Database) |
||
42 | */ |
||
43 | const CHANGE_TYPE_INSERT = 'insert'; |
||
44 | /** |
||
45 | * Partial recording the change (change only the specified field, all existing fields of a record are saved). |
||
46 | * (only Database) |
||
47 | */ |
||
48 | const CHANGE_TYPE_UPDATE = 'update'; |
||
49 | /** |
||
50 | * Complete change of recording (all existing fields are deleted). |
||
51 | * Adding a new field or change existing values. |
||
52 | * (Database & fields) |
||
53 | */ |
||
54 | const CHANGE_TYPE_SET = 'set'; |
||
55 | /** |
||
56 | * Deleting records or Deleting field. |
||
57 | * (Database & fields) |
||
58 | */ |
||
59 | const CHANGE_TYPE_DELETE = 'delete'; |
||
60 | |||
61 | /** |
||
62 | * @var string |
||
63 | */ |
||
64 | protected $changeType; |
||
65 | |||
66 | /** |
||
67 | * @var string |
||
68 | */ |
||
69 | protected $collectionId; |
||
70 | |||
71 | /** |
||
72 | * @var string |
||
73 | */ |
||
74 | protected $recordId; |
||
75 | |||
76 | /** |
||
77 | * @var RecordFields |
||
78 | */ |
||
79 | protected $changes; |
||
80 | |||
81 | /** |
||
82 | * @var RecordFields |
||
83 | */ |
||
84 | protected $fields; |
||
85 | |||
86 | /** |
||
87 | * The revision number after the latest changes to the current record. |
||
88 | * @var string |
||
89 | */ |
||
90 | protected $revision; |
||
91 | |||
92 | /** |
||
93 | * @return string |
||
94 | */ |
||
95 | 1 | public function getChangeType() |
|
99 | |||
100 | /** |
||
101 | * @param string $changeType |
||
102 | * |
||
103 | * @return $this |
||
104 | */ |
||
105 | 4 | public function setChangeType($changeType) |
|
110 | |||
111 | /** |
||
112 | * @return string |
||
113 | */ |
||
114 | 2 | public function getCollectionId() |
|
118 | |||
119 | /** |
||
120 | * @param string $collectionId |
||
121 | * |
||
122 | * @return $this |
||
123 | */ |
||
124 | 4 | public function setCollectionId($collectionId) |
|
129 | |||
130 | /** |
||
131 | * @return RecordFields |
||
132 | */ |
||
133 | 1 | public function getChanges() |
|
137 | |||
138 | /** |
||
139 | * @param RecordFields|array $changes |
||
140 | * |
||
141 | * @return $this |
||
142 | */ |
||
143 | 4 | public function setChanges($changes) |
|
156 | |||
157 | /** |
||
158 | * @return RecordFields |
||
159 | */ |
||
160 | 2 | public function getFields() |
|
164 | |||
165 | /** |
||
166 | * @param RecordFields|array $fields |
||
167 | * |
||
168 | * @return $this |
||
169 | */ |
||
170 | 2 | public function setFields($fields) |
|
182 | |||
183 | /** |
||
184 | * @return string |
||
185 | */ |
||
186 | 2 | public function getRecordId() |
|
190 | |||
191 | /** |
||
192 | * @param $recordId |
||
193 | * |
||
194 | * @return $this |
||
195 | */ |
||
196 | 4 | public function setRecordId($recordId) |
|
201 | |||
202 | /** |
||
203 | * @return string |
||
204 | */ |
||
205 | 1 | public function getRevision() |
|
209 | |||
210 | /** |
||
211 | * @param string $revision |
||
212 | */ |
||
213 | 1 | public function setRevision($revision) |
|
217 | } |
||
218 |