- Модуль: crm
- Путь к файлу: ~/bitrix/modules/crm/lib/update/catalog/mnemoniccode.php
- Класс: Bitrix\Crm\Update\Catalog\MnemonicCode
- Вызов: MnemonicCode::createSectionMnemonicCode
protected function createSectionMnemonicCode(array $options): array
{
$found = false;
$config = [
'CHECK_UNIQUE' => 'Y',
'CHECK_SIMILAR' => 'Y',
];
$iterator = Iblock\SectionTable::getList([
'select' => [
'ID',
'IBLOCK_ID',
'NAME',
'TIMESTAMP_X',
'MODIFIED_BY',
],
'filter' => $this->createFilter($options),
'order' => ['ID' => 'ASC'],
'limit' => self::PAGE_SIZE
]);
while ($row = $iterator->fetch())
{
$found = true;
$row['ID'] = (int)$row['ID'];
$row['IBLOCK_ID'] = (int)$row['IBLOCK_ID'];
$code = $this->section->createMnemonicCode(
$row,
$config
);
if ($code !== null)
{
$this->section->LAST_ERROR = '';
$internalResult = $this->section->Update(
$row['ID'],
[
'CODE' => $code,
'MODIFIED_BY' => $row['MODIFIED_BY'],
]
);
if (!$internalResult)
{
$options['errors']++;
}
}
else
{
$options['errors']++;
}
$options['lastId'] = $row['ID'];
$options['steps']++;
}
unset($row, $iterator);
if (!$found)
{
$options = [];
}
return $options;
}