Skip to content

Commit 5734d2c

Browse files
@Version field is always written
1 parent ccc2d3a commit 5734d2c

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

src/Rules/Doctrine/ORM/PropertiesExtension.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ public function isAlwaysWritten(PropertyReflection $property, string $propertyNa
5151
return false;
5252
}
5353

54+
if ($metadata->versionField === $propertyName) {
55+
return true;
56+
}
57+
5458
try {
5559
$identifiers = $metadata->getIdentifierFieldNames();
5660
} catch (Throwable $e) {

tests/Rules/Doctrine/ORM/data/MyEntity.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ class MyEntity
1919
*/
2020
private $id;
2121

22+
/**
23+
* @ORM\Column(type="integer")
24+
* @ORM\Version
25+
*/
26+
private $version;
27+
2228
/**
2329
* @var string
2430
* @ORM\Column(type="string")

0 commit comments

Comments
 (0)