Skip to content

Commit 7bb89f4

Browse files
committed
fix model clone
1 parent 59f2e8b commit 7bb89f4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/Form/Control/Multiline.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -683,7 +683,7 @@ private function outputJson(): void
683683
{
684684
switch ($_POST['__atkml_action'] ?? null) {
685685
case 'update-row':
686-
$entity = $this->setDummyModelValue($this->model->createEntity());
686+
$entity = $this->createDummyEntityFromPost($this->model);
687687
$expressionValues = array_merge($this->getExpressionValues($entity), $this->getCallbackValues($entity));
688688
$this->getApp()->terminateJson(['success' => true, 'expressions' => $expressionValues]);
689689
// no break - expression above always terminate
@@ -719,9 +719,9 @@ private function getCallbackValues(Model $entity): array
719719
* Looks inside the POST of the request and loads data into model.
720720
* Allow to Run expression base on post row value.
721721
*/
722-
private function setDummyModelValue(Model $entity): Model
722+
private function createDummyEntityFromPost(Model $model): Model
723723
{
724-
$entity = clone $entity; // for clearing "required"
724+
$entity = (clone $model)->createEntity(); // clone for clearing "required"
725725

726726
foreach ($this->fieldDefs as $def) {
727727
$fieldName = $def['name'];

0 commit comments

Comments
 (0)