/**
  * Delete iblock by its code.
  *
  * @param string $code
  *
  * @throws MigrationException
  *
  * @return void
  */
 protected function deleteIblockByCode($code)
 {
     $id = $this->getIblockIdByCode($code);
     $this->db->startTransaction();
     if (!CIBlock::Delete($id)) {
         $this->db->rollbackTransaction();
         throw new MigrationException('Ошибка при удалении инфоблока');
     }
     $this->db->commitTransaction();
 }
Example #2
0
 /**
  * Convert the info block to i18n.
  * 
  * @param string $propCodePublicId
  * @param string $propCodeLang
  * @param string $defaultLang
  * 
  * @throws InternationalizeException
  * @throws \Exception
  */
 public function convert($propCodePublicId, $propCodeLang, $defaultLang)
 {
     $rsDefaultLang = LanguageTable::query()->setFilter(['LID' => $defaultLang])->exec();
     if ($rsDefaultLang->getSelectedRowsCount() <= 0) {
         throw new InternationalizeException([Loc::getMessage('NOTAMEDIA_I18N_IMANAGER_NOT_FOUND_LANG')]);
     }
     foreach ($this->converters as $converter) {
         $this->connection->startTransaction();
         try {
             $converter->internationalize($propCodePublicId, $propCodeLang, $defaultLang);
             $converter->fill($propCodePublicId, $propCodeLang, $defaultLang);
         } catch (\Exception $e) {
             $this->connection->rollbackTransaction();
             throw $e;
         }
         $this->connection->commitTransaction();
     }
 }