Skip to content

Help on object clone #599

Description

@disu

Hello,
I need to add to my software a function to clone an entity containing the upload behavour configured to save files on S3.

I use a code like this pseudo-code and it works well duplicating main entity (Ship) and absociated models (Ship documents, in this example):

  $ship = $this->Ships->get($id, ['contain' => ['ShipsDocs']]);

  $data = $ship->toArray();
  $data['name'] = $ship->name . " - copy";

  $newShip = $this->Ships->newEntity($data, [
     'associated' => ['ShipsDocs'],
  ]);

but how can I trigger the upload behaviour to clone also files on S3, absociated to the source entity, and absociate the new ones to the cloned entity?
Give me some hint please.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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