Skip to content

Commit b0247c2

Browse files
committed
Merge branch '6.4' into 7.1
* 6.4: [FrameworkBundle] Add missing `not-compromised-password` entry in XSD [AssetMapper] Fix CssCompiler matches url in comments Add support for doctrine/persistence 4 Ensure TransportExceptionInterface populates stream debug data Fix typo in validators.sk.xlf [Mime] Fix body validity check in `Email` when using `Message::setBody()` Review Arabic translations for the validator Fixed mistakes in proper hebrew writing in the previous translation and confirmed the rest to be correct and in the same style. Review translation [Cache] Don't clear system caches on cache:clear [FrameworkBundle] Fix patching refs to the tmp warmup dir in files generated by optional cache warmers Mark Czech Validator translation as reviewed [PropertyInfo] Fix `TypeTest` duplicated assert [HtmlSanitizer] Avoid accessing non existent array key when checking for hosts validity Update validators.ar.xlf [DomCrawler] Make `ChoiceFormField::isDisabled` return `true` for unchecked disabled checkboxes
2 parents e24ecd5 + fd0094d commit b0247c2

File tree

4 files changed

+22
-12
lines changed

4 files changed

+22
-12
lines changed

Diff for: Tests/ArgumentResolver/EntityValueResolverTest.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -487,9 +487,13 @@ private function createRegistry(?ObjectManager $manager = null): ManagerRegistry
487487
->method('getManagerForClass')
488488
->willReturn($manager);
489489

490-
$registry->expects($this->any())
491-
->method('getManager')
492-
->willReturn($manager);
490+
if (null === $manager) {
491+
$registry->method('getManager')
492+
->willThrowException(new \InvalidArgumentException());
493+
} else {
494+
$registry->method('getManager')->willReturn($manager);
495+
}
496+
493497

494498
return $registry;
495499
}

Diff for: Tests/Validator/Constraints/UniqueEntityValidatorTest.php

+10-4
Original file line numberDiff line numberDiff line change
@@ -84,10 +84,16 @@ protected function setUp(): void
8484
protected function createRegistryMock($em = null)
8585
{
8686
$registry = $this->createMock(ManagerRegistry::class);
87-
$registry->expects($this->any())
88-
->method('getManager')
89-
->with($this->equalTo(self::EM_NAME))
90-
->willReturn($em);
87+
88+
if (null === $em) {
89+
$registry->method('getManager')
90+
->with($this->equalTo(self::EM_NAME))
91+
->willThrowException(new \InvalidArgumentException());
92+
} else {
93+
$registry->method('getManager')
94+
->with($this->equalTo(self::EM_NAME))
95+
->willReturn($em);
96+
}
9197

9298
return $registry;
9399
}

Diff for: Validator/Constraints/UniqueEntityValidator.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,10 @@ public function validate(mixed $value, Constraint $constraint): void
6969
$entityClass = $constraint->entityClass ?? $value::class;
7070

7171
if ($constraint->em) {
72-
$em = $this->registry->getManager($constraint->em);
73-
74-
if (!$em) {
75-
throw new ConstraintDefinitionException(sprintf('Object manager "%s" does not exist.', $constraint->em));
72+
try {
73+
$em = $this->registry->getManager($constraint->em);
74+
} catch (\InvalidArgumentException $e) {
75+
throw new ConstraintDefinitionException(sprintf('Object manager "%s" does not exist.', $constraint->em), 0, $e);
7676
}
7777
} else {
7878
$em = $this->registry->getManagerForClass($entityClass);

Diff for: composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"require": {
1919
"php": ">=8.2",
2020
"doctrine/event-manager": "^2",
21-
"doctrine/persistence": "^3.1",
21+
"doctrine/persistence": "^3.1|^4",
2222
"symfony/deprecation-contracts": "^2.5|^3",
2323
"symfony/polyfill-ctype": "~1.8",
2424
"symfony/polyfill-mbstring": "~1.0",

0 commit comments

Comments
 (0)