Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Help on object clone #599

Open
disu opened this issue Aug 30, 2023 · 0 comments
Open

Help on object clone #599

disu opened this issue Aug 30, 2023 · 0 comments

Comments

@disu
Copy link

disu commented Aug 30, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant