8000 [DoctrineBridge] Auto-validation must work if no regex are passed · symfony/symfony@5612e7d · GitHub
[go: up one dir, main page]

Skip to content
10000

Commit 5612e7d

Browse files
committed
[DoctrineBridge] Auto-validation must work if no regex are passed
1 parent 766162c commit 5612e7d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Symfony/Bridge/Doctrine/Tests/Validator/DoctrineLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ public function testClassValidator(bool $expected, string $classValidatorRegexp
173173
public function regexpProvider()
174174
{
175175
return [
176-
[false, null],
176+
[true, null],
177177
[true, '{^'.preg_quote(DoctrineLoaderEntity::class).'$|^'.preg_quote(Entity::class).'$}'],
178178
[false, '{^'.preg_quote(Entity::class).'$}'],
179179
];

src/Symfony/Bridge/Doctrine/Validator/DoctrineLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function __construct(EntityManagerInterface $entityManager, string $class
4343
public function loadClassMetadata(ClassMetadata $metadata): bool
4444
{
4545
$className = $metadata->getClassName();
46-
if (null === $this->classValidatorRegexp || !preg_match($this->classValidatorRegexp, $className)) {
46+
if (null !== $this->classValidatorRegexp && !preg_match($this->classValidatorRegexp, $className)) {
4747
return false;
4848
}
4949

0 commit comments

Comments
 (0)
0