Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[DoctrineBridge] Add support for doctrine/persistence 4 #59575

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

Merged
merged 1 commit into from
Jan 25, 2025
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
2 changes: 1 addition & 1 deletion 2 composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
"ext-xml": "*",
"friendsofphp/proxy-manager-lts": "^1.0.2",
"doctrine/event-manager": "^1.2|^2",
"doctrine/persistence": "^2.5|^3.1",
"doctrine/persistence": "^2.5|^3.1|^4",
"twig/twig": "^2.13|^3.0.4",
"psr/cache": "^2.0|^3.0",
"psr/clock": "^1.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,9 +415,13 @@ private function createRegistry(?ObjectManager $manager = null): ManagerRegistry
->method('getManagerForClass')
->willReturn($manager);

$registry->expects($this->any())
->method('getManager')
->willReturn($manager);
if (null === $manager) {
$registry->method('getManager')
->willThrowException(new \InvalidArgumentException());
} else {
$registry->method('getManager')->willReturn($manager);
}


return $registry;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,10 +76,16 @@ protected function setUp(): void
protected function createRegistryMock($em = null)
{
$registry = $this->createMock(ManagerRegistry::class);
$registry->expects($this->any())
->method('getManager')
->with($this->equalTo(self::EM_NAME))
->willReturn($em);

if (null === $em) {
$registry->method('getManager')
->with($this->equalTo(self::EM_NAME))
->willThrowException(new \InvalidArgumentException());
} else {
$registry->method('getManager')
->with($this->equalTo(self::EM_NAME))
->willReturn($em);
}

return $registry;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ public function validate(mixed $entity, Constraint $constraint)
}

if ($constraint->em) {
$em = $this->registry->getManager($constraint->em);

if (!$em) {
throw new ConstraintDefinitionException(sprintf('Object manager "%s" does not exist.', $constraint->em));
greg0ire marked this conversation as resolved.
Show resolved Hide resolved
try {
$em = $this->registry->getManager($constraint->em);
} catch (\InvalidArgumentException $e) {
throw new ConstraintDefinitionException(sprintf('Object manager "%s" does not exist.', $constraint->em), 0, $e);
}
} else {
$em = $this->registry->getManagerForClass($entity::class);
Expand Down
2 changes: 1 addition & 1 deletion 2 src/Symfony/Bridge/Doctrine/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"require": {
"php": ">=8.1",
"doctrine/event-manager": "^1.2|^2",
"doctrine/persistence": "^2.5|^3.1",
"doctrine/persistence": "^2.5|^3.1|^4",
"symfony/deprecation-contracts": "^2.5|^3",
"symfony/polyfill-ctype": "~1.8",
"symfony/polyfill-mbstring": "~1.0",
Expand Down
Loading
Morty Proxy This is a proxified and sanitized view of the page, visit original site.