Skip to content

Commit 8e808a3

Browse files
comparing castable attributes just by serialization
1 parent 40ecfd0 commit 8e808a3

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

src/Eloquent/DocumentModel.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -379,13 +379,6 @@ public function originalIsEquivalent($key)
379379
}
380380

381381
if ($this->isClassCastable($key)) {
382-
$attribute = $this->castAttribute($key, $attribute);
383-
$original = $this->castAttribute($key, $original);
384-
385-
if ($attribute === $original) {
386-
return true;
387-
}
388-
389382
return serialize($attribute) === serialize($original);
390383
}
391384

tests/ModelTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1084,6 +1084,9 @@ public function testGetDirtyObjects(): void
10841084

10851085
$user->save();
10861086
$this->assertEmpty($user->getDirty());
1087+
1088+
$user->options = (new Options())->setOption1('Value1');
1089+
$this->assertNotEmpty($user->getDirty());
10871090
}
10881091

10891092
public function testChunkById(): void

0 commit comments

Comments
 (0)