Skip to content

Commit

Permalink
fix #676
Browse files Browse the repository at this point in the history
  • Loading branch information
jkavalik committed Oct 8, 2024
1 parent bd779d8 commit 2211b54
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
15 changes: 12 additions & 3 deletions src/Mapper/Dbal/DbalMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,10 @@ public function persist(IEntity $entity): void

} else {
$primary = [];
$id = (array) $entity->getPersistedId();
$id = $entity->getPersistedId();
if (!is_array($id)) {
$id = [$id];
}
foreach ($entity->getMetadata()->getPrimaryKey() as $key) {
$primary[$key] = array_shift($id);
}
Expand Down Expand Up @@ -458,7 +461,10 @@ protected function processMySQLAutoupdate(IEntity $entity, array $args): void

$conventions = $this->getConventions();

$id = (array) $entity->getPersistedId();
$id = $entity->getPersistedId();
if (!is_array($id)) {
$id = [$id];
}
$primary = [];
foreach ($entity->getMetadata()->getPrimaryKey() as $key) {
$primary[$key] = array_shift($id);
Expand Down Expand Up @@ -487,7 +493,10 @@ public function remove(IEntity $entity): void
$conventions = $this->getConventions();

$primary = [];
$id = (array) $entity->getPersistedId();
$id = $entity->getPersistedId();
if (!is_array($id)) {
$id = [$id];
}
foreach ($entity->getMetadata()->getPrimaryKey() as $key) {
$key = $conventions->convertEntityToStorageKey($key);
$primary[$key] = array_shift($id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ START TRANSACTION;
INSERT INTO "logs" ("date", "count") VALUES ('2022-03-06 03:03:03.000000'::timestamptz, 3);
COMMIT;
START TRANSACTION;
UPDATE "logs" SET "count" = 5 WHERE "date" = '2022-03-06 03:03:03.000000';
UPDATE "logs" SET "count" = 5 WHERE "date" = '2022-03-06 03:03:03.000000'::timestamptz;
COMMIT;
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ COMMIT;
SELECT "time_series".* FROM "time_series" AS "time_series" WHERE (("time_series"."date" = '2022-03-06 03:03:03.000000'::timestamptz));
SELECT "time_series".* FROM "time_series" AS "time_series" WHERE (("time_series"."date" = '2022-03-06 03:03:03.000000'::timestamptz));
START TRANSACTION;
UPDATE "time_series" SET "value" = 5 WHERE "date" = '2022-03-06 04:03:03.000000';
UPDATE "time_series" SET "value" = 5 WHERE "date" = '2022-03-06 03:03:03.000000'::timestamptz;
COMMIT;
SELECT "time_series".* FROM "time_series" AS "time_series" WHERE (("time_series"."date" = '2022-03-06 03:03:03.000000'::timestamptz));

0 comments on commit 2211b54

Please sign in to comment.