Skip to content

Commit

Permalink
Merge pull request #63
Browse files Browse the repository at this point in the history
Fix a bug in where condition when persisting entity
  • Loading branch information
williarin authored Dec 5, 2023
2 parents 1b8e4c6 + 57fd99c commit 81d72db
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,15 @@ jobs:

runs-on: ubuntu-20.04

continue-on-error: ${{ matrix.experimental }}

strategy:
fail-fast: true
matrix:
php: ['8.0', '8.1', '8.2']
php: ['8.0', '8.1', '8.2', '8.3']
experimental: [false]
include:
- php: '8.3'
- php: '8.4'
experimental: true

steps:
Expand Down
2 changes: 1 addition & 1 deletion src/Bridge/Repository/AbstractEntityRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -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})
;

Expand Down
4 changes: 4 additions & 0 deletions test/Test/Bridge/Repository/PostRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 81d72db

Please sign in to comment.