Deep copy is not copying "Many" childs

Hi,

CampaignEntity has many AdGroupEntity and AdGroupEntity has Many AdEntity.
When I clone CampaignEntity the “many” column adGroups is not cloned. see image below.
I would like to clone CampaignEntity with all its children. is it possible via deepCopy?

Also, according to the source code, the id is also cloned. why is that? I need to save it with new id (also the children).
Thanks

image

Hi

By design deepCopy saves same ids for entities. You can assign new ids for entities in your case.
Also deepCopy should clone the many properties (if property is loaded). May be property isn’t loaded.
Could you provide sample project with error?

Hi,
Thanks, but there is no error.
So I need to loop the entire tree and reset the IDs, so when I persist the object tree it will be saved as new?
Thanks.

Yes. And you should persist all copied entities.