Skip to content

Commit

Permalink
Fixed store of primary key when it consists of multiple columns
Browse files Browse the repository at this point in the history
  • Loading branch information
Marco Piazza committed Apr 20, 2023
1 parent b4ea679 commit 9d7150e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
Yii2-ActiveRecord-History Extension for Yii 2 ChangeLog
==============================================

1.2.2 Apr 20, 2023
-------------------------

- Fixed store of primary key when it consists of multiple columns

1.2.1 Jul 05, 2022
-------------------------

Expand Down
6 changes: 5 additions & 1 deletion src/managers/BaseManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,13 @@ public function run($type, $object)
$pk = $object->primaryKey();
$pk = $pk[0];

$pkValue = $object->getPrimaryKey();
if(is_array($pkValue)) {
$pkValue = Json::encode($pkValue);
}
$data = [
'table' => $object->tableName(),
'field_id' => $object->getPrimaryKey(),
'field_id' => $pkValue,
'type' => $type,
'date' => date('Y-m-d H:i:s', time()),
'action' => Yii::$app->requestedRoute,
Expand Down

0 comments on commit 9d7150e

Please sign in to comment.