diff --git a/src/Bridge/Repository/AbstractEntityRepository.php b/src/Bridge/Repository/AbstractEntityRepository.php index b2889f7..b8b6e44 100644 --- a/src/Bridge/Repository/AbstractEntityRepository.php +++ b/src/Bridge/Repository/AbstractEntityRepository.php @@ -206,7 +206,7 @@ public function persist(mixed $entity): void $queryBuilder = $this->entityManager->getConnection() ->createQueryBuilder() ->update($this->entityManager->getTablesPrefix() . static::TABLE_NAME) - ->where(static::TABLE_IDENTIFIER, ':' . static::TABLE_IDENTIFIER) + ->where(static::TABLE_IDENTIFIER . ' = :' . static::TABLE_IDENTIFIER) ->setParameter(static::TABLE_IDENTIFIER, $entity->{static::TABLE_IDENTIFIER}) ; diff --git a/test/Test/Bridge/Repository/PostRepositoryTest.php b/test/Test/Bridge/Repository/PostRepositoryTest.php index d7fea3e..234b9a1 100644 --- a/test/Test/Bridge/Repository/PostRepositoryTest.php +++ b/test/Test/Bridge/Repository/PostRepositoryTest.php @@ -267,6 +267,10 @@ public function testPersistExistingPost(): void self::assertSame('Another post with a new title', $post->postTitle); self::assertSame('publish', $post->postStatus); + + // Assert no collateral damages + $anotherPost = $this->repository->find(10); + self::assertSame('A post', $anotherPost->postTitle); } public function testDynamicSetter(): void