1 | <?php |
||
13 | class BitrixMigration implements MigrationInterface |
||
14 | { |
||
15 | /** |
||
16 | * DB connection. |
||
17 | * |
||
18 | * @var Connection |
||
19 | */ |
||
20 | protected $db; |
||
21 | |||
22 | /** |
||
23 | * @var bool |
||
24 | */ |
||
25 | public $use_transaction = null; |
||
26 | |||
27 | /** |
||
28 | * Constructor. |
||
29 | */ |
||
30 | public function __construct() |
||
34 | |||
35 | /** |
||
36 | * Run the migration. |
||
37 | * |
||
38 | * @return mixed |
||
39 | */ |
||
40 | public function up() |
||
44 | |||
45 | /** |
||
46 | * Reverse the migration. |
||
47 | * |
||
48 | * @return mixed |
||
49 | */ |
||
50 | public function down() |
||
54 | |||
55 | /** |
||
56 | * Does migration use transaction |
||
57 | * @param bool $default |
||
58 | * @return bool |
||
59 | */ |
||
60 | public function useTransaction($default = false) |
||
68 | |||
69 | /** |
||
70 | * Find iblock id by its code. |
||
71 | * |
||
72 | * @param string $code |
||
73 | * @param null|string $iBlockType |
||
74 | * |
||
75 | * @throws MigrationException |
||
76 | * |
||
77 | * @return int |
||
78 | */ |
||
79 | protected function getIblockIdByCode($code, $iBlockType = null) |
||
102 | |||
103 | /** |
||
104 | * Delete iblock by its code. |
||
105 | * |
||
106 | * @param string $code |
||
107 | * |
||
108 | * @throws MigrationException |
||
109 | * |
||
110 | * @return void |
||
111 | */ |
||
112 | protected function deleteIblockByCode($code) |
||
124 | |||
125 | /** |
||
126 | * Add iblock element property. |
||
127 | * |
||
128 | * @param array $fields |
||
129 | * |
||
130 | * @throws MigrationException |
||
131 | * |
||
132 | * @return int |
||
133 | */ |
||
134 | public function addIblockElementProperty($fields) |
||
145 | |||
146 | /** |
||
147 | * Delete iblock element property. |
||
148 | * |
||
149 | * @param string $code |
||
150 | * @param string|int $iblockId |
||
151 | * |
||
152 | * @throws MigrationException |
||
153 | */ |
||
154 | public function deleteIblockElementPropertyByCode($iblockId, $code) |
||
168 | |||
169 | /** |
||
170 | * Add User Field. |
||
171 | * |
||
172 | * @param $fields |
||
173 | * |
||
174 | * @throws MigrationException |
||
175 | * |
||
176 | * @return int |
||
177 | */ |
||
178 | public function addUF($fields) |
||
198 | |||
199 | /** |
||
200 | * Get UF by its code. |
||
201 | * |
||
202 | * @param string $entity |
||
203 | * @param string $code |
||
204 | * |
||
205 | * @throws MigrationException |
||
206 | */ |
||
207 | public function getUFIdByCode($entity, $code) |
||
229 | |||
230 | /** |
||
231 | * @param $code |
||
232 | * @param $iblockId |
||
233 | * |
||
234 | * @throws MigrationException |
||
235 | * |
||
236 | * @return array |
||
237 | */ |
||
238 | protected function getIblockPropIdByCode($code, $iblockId) |
||
252 | } |
||
253 |