Skip to content

Commit

Permalink
Merge 4.x into 5.x
Browse files Browse the repository at this point in the history
  • Loading branch information
SonataCI committed Nov 4, 2022
2 parents 1d55bb4 + 9b24cfd commit 1fd8e95
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
13 changes: 13 additions & 0 deletions src/Model/AuditReader.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,21 @@ public function find(string $className, $id, $revisionId): ?object
}
}

/**
* NEXT_MAJOR: Change the default limit value to `null`.
*/
public function findRevisionHistory(string $className, ?int $limit = 20, ?int $offset = 0): array
{
// NEXT_MAJOR: Remove this check and restrict offset native type to `int`.
if (null === $offset) {
@trigger_error(
'Using a null offset when retrieving the revision history is deprecated'
.'since sonata-project/doctrine-orm-admin-bundle 4.9 and will throw an error in 5.0.',
\E_USER_DEPRECATED
);
$offset = 0;
}

return array_map(
[$this, 'createRevisionFromEntityAuditRevision'],
$this->auditReader->findRevisionHistory($limit, $offset)
Expand Down
2 changes: 1 addition & 1 deletion tests/custom_bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
use Symfony\Component\Console\Output\NullOutput;
use Symfony\Component\Filesystem\Filesystem;

$kernel = new AppKernel($_SERVER['APP_ENV'], (bool) $_SERVER['APP_DEBUG']);
$kernel = new AppKernel($_SERVER['APP_ENV'] ?? 'test', (bool) ($_SERVER['APP_DEBUG'] ?? false));
$application = new Application($kernel);
$application->setAutoExit(false);

Expand Down

0 comments on commit 1fd8e95

Please sign in to comment.