Skip to content

Commit 726042e

Browse files
bug #50788 [Validator] Fix regression with class metadatada on parent classes (rmikalkenas)
This PR was merged into the 5.4 branch. Discussion ---------- [Validator] Fix regression with class metadatada on parent classes | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | yes | New feature? | no | Deprecations? | no | Tickets | Fix #50780 | License | MIT Commits ------- e98f5f2782 [Validator] Fix regression with class metadatada on parent classes
2 parents 3550dde + 8bebc82 commit 726042e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

Validator/DoctrineLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ public function loadClassMetadata(ClassMetadata $metadata): bool
108108
if (isset($mapping['originalClass']) && !str_contains($mapping['declaredField'], '.')) {
109109
$metadata->addPropertyConstraint($mapping['declaredField'], new Valid());
110110
$loaded = true;
111-
} elseif (property_exists($className, $mapping['fieldName'])) {
111+
} elseif (property_exists($className, $mapping['fieldName']) && (!$doctrineMetadata->isMappedSuperclass || $metadata->getReflectionClass()->getProperty($mapping['fieldName'])->isPrivate())) {
112112
$metadata->addPropertyConstraint($mapping['fieldName'], new Length(['max' => $mapping['length']]));
113113
$loaded = true;
114114
}

0 commit comments

Comments
 (0)