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

refactor: rename getReference to reference #56

Merged
merged 1 commit into from
Jun 23, 2024
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* deps: update rekapager to 0.12.0
* deps: add debug bundle
* refactor: move `refreshCount` to its own interface
* refactor: rename `getReference` to `reference`

## 0.3.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ interface BasicReadableRepository extends BasicReadableRecollection
* @param TKey $key
* @return T
*/
public function getReference(int|string $key): object;
public function reference(int|string $key): object;
}
2 changes: 1 addition & 1 deletion packages/collections-contracts/src/ReadableRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,5 +24,5 @@ interface ReadableRepository extends ReadableRecollection
* @param TKey $key
* @return T
*/
public function getReference(int|string $key): object;
public function reference(int|string $key): object;
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ trait BasicRepositoryTrait
* @param TKey $key
* @return T
*/
public function getReference(int|string $key): object
public function reference(int|string $key): object
{
return $this->getEntityManager()
->getReference($this->getClass(), $key)
Expand Down
4 changes: 2 additions & 2 deletions tests/src/IntegrationTests/AbstractBasicRepositoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ public function testContainsKeyNegative(): void

public function testGetReference(): void
{
$country = $this->getRepository()->getReference(1);
$country = $this->getRepository()->reference(1);
static::assertInstanceOf(Country::class, $country);
$name = $country->getName();
static::assertIsString($name);
}

public function testGetReferenceNegative(): void
{
$country = $this->getRepository()->getReference(9999999);
$country = $this->getRepository()->reference(9999999);
$this->expectException(EntityNotFoundException::class);
$name = $country->getName();
}
Expand Down