Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug in where condition when persisting entity #63

Merged
merged 2 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading