Skip to content

Commit

Permalink
Additional fixes to Clone Command (CO-479)
Browse files Browse the repository at this point in the history
  • Loading branch information
Benn Oshrin committed Feb 25, 2026
1 parent 5b9724b commit ada9a0b
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/src/Command/CloneCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -796,6 +796,7 @@ protected function cloneEntityRelations(
$srcent,
$TargetRelatedTable,
$targetent,
$parent_key,
$cloneId,
$targetDataSource,
$targetCoId
Expand Down Expand Up @@ -845,6 +846,7 @@ protected function cloneEntityRelations(
$srcent,
$TargetRelatedTable,
$targetent,
$parent_key,
$cloneId,
$targetDataSource,
$targetCoId,
Expand Down Expand Up @@ -954,6 +956,7 @@ protected function cloneTypes(
* @param Entity $srcent Source (original) Entity
* @param Table $TargetRelatedTable Target Table
* @param Entity $targetent Target Entity, if one exists
* @param string $parentKey Parent key from $targetent to its parent record
* @param int $cloneId The clone record ID
* @param string $targetDataSource Label for the target datasource
* @param int $targetCoId CO ID in the target datasource
Expand All @@ -966,6 +969,7 @@ protected function cloneUpsert(
\Cake\ORM\Entity $srcent,
\Cake\ORM\Table $TargetRelatedTable,
?\Cake\ORM\Entity $targetent,
string $parentKey,
int $cloneId,
string $targetDataSource,
int $targetCoId,
Expand Down Expand Up @@ -1038,7 +1042,7 @@ protected function cloneUpsert(

// Insert the parent key, _after_ fixing the foreign keys. (We could actually insert the
// source FK and let fixCloneForeignKeys correct it, but this is clearer)
$targetent->$parent_key = $cloneId;
$targetent->$parentKey = $cloneId;

if($injectOriginalId) {
// Insert originalid, _after_ fixing the foreign keys
Expand Down

0 comments on commit ada9a0b

Please sign in to comment.