Skip to content

Commit f159eb9

Browse files
curry684ondrejmirtes
authored andcommitted
Fix missing field mappings in Doctrine
1 parent 2c4e70a commit f159eb9

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Rules/Doctrine/ORM/PropertiesExtension.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,11 @@ public function isAlwaysWritten(PropertyReflection $property, string $propertyNa
4545
return false;
4646
}
4747

48-
$mapping = $metadata->getFieldMapping($propertyName);
49-
if (array_key_exists('generated', $mapping) && $mapping['generated'] !== ClassMetadataInfo::GENERATED_NEVER) {
50-
return true;
48+
if (isset($metadata->fieldMappings[$propertyName])) {
49+
$mapping = $metadata->fieldMappings[$propertyName];
50+
if (array_key_exists('generated', $mapping) && $mapping['generated'] !== ClassMetadataInfo::GENERATED_NEVER) {
51+
return true;
52+
}
5153
}
5254

5355
if ($metadata->isReadOnly && !$declaringClass->hasConstructor()) {

0 commit comments

Comments
 (0)