Skip to content

Commit

Permalink
fix enableLogging
Browse files Browse the repository at this point in the history
base on :
yiisoft#314
  • Loading branch information
ziaratban committed Jul 9, 2020
1 parent c6808c7 commit a4fd97a
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/ActiveRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -504,10 +504,11 @@ private static function batchInsertInit(){
return;
self::$batchInsertInit = true;
self::$batchInsertCommand = static::getDb()->createCommand();
register_shutdown_function(function(){
if(self::hasBatchInsert())
yii::warning(static::className().' : batch insert mode not completed!');
});
if(self::$batchInsertCommand->db->enableLogging)
register_shutdown_function(function(){
if(self::hasBatchInsert())
yii::warning(static::className().' : batch insert mode not completed!');
});
}

/**
Expand Down Expand Up @@ -570,10 +571,11 @@ private static function batchUpdateInit(){
return;
self::$batchUpdateInit = true;
self::$batchUpdateCommand = static::getDb()->createCommand();
register_shutdown_function(function(){
if(self::hasBatchUpdate())
yii::warning(static::className().' : batch update mode not completed!');
});
if(self::$batchUpdateCommand->db->enableLogging)
register_shutdown_function(function(){
if(self::hasBatchUpdate())
yii::warning(static::className().' : batch update mode not completed!');
});
}

/**
Expand Down Expand Up @@ -648,10 +650,11 @@ private static function batchDeleteInit(){
return;
self::$batchDeleteInit = true;
self::$batchDeleteCommand = static::getDb()->createCommand();
register_shutdown_function(function(){
if(self::hasBatchDelete())
yii::warning(static::className().' : batch delete mode not completed!');
});
if(self::$batchDeleteCommand->db->enableLogging)
register_shutdown_function(function(){
if(self::hasBatchDelete())
yii::warning(static::className().' : batch delete mode not completed!');
});
}

/**
Expand Down

0 comments on commit a4fd97a

Please sign in to comment.