Skip to content
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
9 changes: 9 additions & 0 deletions UPGRADE.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,15 @@ awareness about deprecated code.

# Upgrade to 5.0

## BC Break: `ObjectRepository::findBy()` `$orderBy` additionally accepts the `SortDirection` enum

The `$orderBy` parameter of `findBy()` now also accepts the PHP 8.6 `SortDirection`
enum, in addition to the `'asc'`, `'desc'`, `'ASC'` and `'DESC'` strings. The native
signature is unchanged and strings remain accepted.

Implementations of `ObjectRepository` must accept the enum and cannot declare a
more restrictive type for `$orderBy`.

## BC Break: `ClassMetadata::getFieldValue()` and `setFieldValue()` are now required

The methods `getFieldValue()` and `setFieldValue()` are now required by the
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
"doctrine/coding-standard": "^14",
"phpunit/phpunit": "^10.5.58 || ^12",
"symfony/cache": "^4.4 || ^5.4 || ^6.0 || ^7.0 || ^8.0",
"symfony/finder": "^4.4 || ^5.4 || ^6.0 || ^7.0 || ^8.0"
"symfony/finder": "^4.4 || ^5.4 || ^6.0 || ^7.0 || ^8.0",
"symfony/polyfill-php86": "^1.41"
},
"autoload": {
"psr-4": {
Expand Down
7 changes: 4 additions & 3 deletions src/ObjectRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

namespace Doctrine\Persistence;

use SortDirection;
use UnexpectedValueException;

/**
Expand Down Expand Up @@ -38,9 +39,9 @@ public function findAll(): array;
* an UnexpectedValueException if certain values of the sorting or limiting details are
* not supported.
*
* @param array<string, mixed> $criteria
* @param array<string, string>|null $orderBy
* @phpstan-param array<string, 'asc'|'desc'|'ASC'|'DESC'>|null $orderBy
* @param array<string, mixed> $criteria
* @param array<string, string|SortDirection>|null $orderBy
* @phpstan-param array<string, 'asc'|'desc'|'ASC'|'DESC'|SortDirection>|null $orderBy
*
* @return array<int, object> The objects.
* @phpstan-return list<T>
Expand Down