From 01646e444761b05f5d8092cf7f6ec06dfdbf1c50 Mon Sep 17 00:00:00 2001 From: Dan Harrin Date: Fri, 1 Aug 2025 08:11:59 -0600 Subject: [PATCH] Update ReplicateAction.php --- packages/actions/src/ReplicateAction.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/actions/src/ReplicateAction.php b/packages/actions/src/ReplicateAction.php index 5b1f417497..f8de7c90ca 100644 --- a/packages/actions/src/ReplicateAction.php +++ b/packages/actions/src/ReplicateAction.php @@ -144,4 +144,13 @@ class ReplicateAction extends Action default => parent::resolveDefaultClosureDependencyForEvaluationByName($parameterName), }; } + + public function getSchema(Schema $schema): ?Schema + { + // By default, the schema's model will be set to the original record that is being replicated. + // However, since the schema is used to create a new replica, it is more appropriate to set + // the schema's model to the replica model FQN instead. This ensures that it does not + // behave as if the original record is edited instead of a new record being created. + return parent::getSchema($schema)?->model($this->getModel()); + } }