Skip to content

update foreign IDs #54

@deanzod

Description

@deanzod

Is there a way to clone a model with a relation, but on the related model also update another ID column to match the equivalent cloned model's ID?

e.g.
Say you have Section containing many Posts and Comments. A post has many comments. But a comment also belongsTo a different post in that section:

Table: comments
id | post_id | related_post_id

Clone a section & Posts, with comments (straight forward)

But then if I make the relatedPost relationship cloneable, yes it updates the related_post_id in the new comment row, but it also creates a new clone of that post too. How can I get it to just change the foreign_id without creating double posts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions