Skip to content
This repository was archived by the owner on Jan 10, 2023. It is now read-only.

Commit b7fed41

Browse files
authored
Merge pull request #3 from olegpro/bitrixmigration-improvement
Improved method getIblockIdByCode class BitrixMigration
2 parents 92ad000 + 34d4975 commit b7fed41

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/BaseMigrations/BitrixMigration.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,13 @@ public function down()
5151
* Find iblock id by its code.
5252
*
5353
* @param string $code
54+
* @param null|string $iBlockType
5455
*
5556
* @throws MigrationException
5657
*
5758
* @return int
5859
*/
59-
protected function getIblockIdByCode($code)
60+
protected function getIblockIdByCode($code, $iBlockType = null)
6061
{
6162
if (!$code) {
6263
throw new MigrationException('Не задан код инфоблока');
@@ -67,6 +68,10 @@ protected function getIblockIdByCode($code)
6768
'CHECK_PERMISSIONS' => 'N',
6869
];
6970

71+
if ($iBlockType !== null) {
72+
$filter['TYPE'] = $iBlockType;
73+
}
74+
7075
$iblock = (new CIBlock())->GetList([], $filter)->fetch();
7176

7277
if (!$iblock['ID']) {

0 commit comments

Comments
 (0)