Skip to content

Commit 4262eb4

Browse files
authored
fix: update index to be serialized in __sleep() (#12366)
Signed-off-by: Vikram Vaswani <2571660+vvaswani@users.noreply.github.com`>
1 parent d3b47d2 commit 4262eb4

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/Mapping/FieldMapping.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ public function __sleep(): array
142142
{
143143
$serialized = ['type', 'fieldName', 'columnName'];
144144

145-
foreach (['nullable', 'notInsertable', 'notUpdatable', 'id', 'unique', 'version', 'quoted'] as $boolKey) {
145+
foreach (['nullable', 'notInsertable', 'notUpdatable', 'id', 'unique', 'version', 'quoted', 'index'] as $boolKey) {
146146
if ($this->$boolKey) {
147147
$serialized[] = $boolKey;
148148
}

tests/Tests/ORM/Mapping/FieldMappingTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public function testItSurvivesSerialization(): void
3333
$mapping->precision = 10;
3434
$mapping->scale = 2;
3535
$mapping->unique = true;
36+
$mapping->index = true;
3637
$mapping->inherited = self::class;
3738
$mapping->originalClass = self::class;
3839
$mapping->originalField = 'id';
@@ -57,6 +58,7 @@ public function testItSurvivesSerialization(): void
5758
self::assertSame(10, $resurrectedMapping->precision);
5859
self::assertSame(2, $resurrectedMapping->scale);
5960
self::assertTrue($resurrectedMapping->unique);
61+
self::assertTrue($resurrectedMapping->index);
6062
self::assertSame(self::class, $resurrectedMapping->inherited);
6163
self::assertSame(self::class, $resurrectedMapping->originalClass);
6264
self::assertSame('id', $resurrectedMapping->originalField);

0 commit comments

Comments
 (0)