Skip to content
This repository was archived by the owner on Sep 11, 2018. It is now read-only.

Commit f89e4f7

Browse files
committed
Clones the model to prevent unwanted modifications
1 parent 4d4f157 commit f89e4f7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/ModelHelper.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,11 @@ public function wouldBeIndexed(Model $model, $index_name)
4949
return false;
5050
}
5151

52-
$model->setRawAttributes($model->getOriginal());
52+
$cloned = clone $model;
5353

54-
return $model->indexOnly($index_name) === true;
54+
$cloned->setRawAttributes($cloned->getOriginal());
55+
56+
return $cloned->indexOnly($index_name) === true;
5557
}
5658

5759
public function getObjectId(Model $model)

0 commit comments

Comments
 (0)