Skip to content

Commit

Permalink
fixes and improvements
Browse files Browse the repository at this point in the history
 - fix behavior detaching
  • Loading branch information
eLFuvo committed Nov 27, 2020
1 parent f74cf79 commit 9aa20f0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/ImportService.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,14 +185,14 @@ public function importBatch(): bool
if ($progress = $this->getResult()->getLastBatch()) {
$this->adapter->setProgress($progress);
}
$behaviors = array_keys($this->model->getBehaviors());
if ($rows = $this->adapter->getBatchData()) {
$transaction = Yii::$app->db->beginTransaction();
foreach ($rows as $row) {
$existsModelConditions = [];
/** @var Model|ActiveRecord $model */
$model = clone $this->model;
// some behaviors can be detached for the original model
$behaviors = $this->model->getBehaviors();
foreach ($model->getBehaviors() as $behavior => $config) {
if (!in_array($behavior, $behaviors)) {
$model->detachBehavior($behavior);
Expand Down
6 changes: 3 additions & 3 deletions src/messages/ru/import-wizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
'Data imported' => 'Данные импортированы',
'Import statistics' => 'Статистика импорта',
'Items added' => 'Добавлено элементов',
'Items updated' => 'Добавлено элементов',
'Items deleted' => 'Добавлено элементов',
'Ignored lines' => 'Добавлено элементов',
'Items updated' => 'Обновлено элементов',
'Items deleted' => 'Удалено элементов',
'Ignored lines' => 'Пропущено элементов',
'Errors' => 'Ошибки',
'Reset' => 'Сбросить настройки',
];

0 comments on commit 9aa20f0

Please sign in to comment.