I have created an entity A
with OneToMany
relation to B
, which have relation OneToMany
to C
.
I have to clone this A
entity and set it in database with new id. Also all deep relations should be cloned with new ids too.
What have I tried is to set A
id to null
:
$A = clone $A_original;
$A->setId(null);
$em->persist($A);
It creates new record in A
table, but does not in B
and C
.
What should I do to make a full copy of A
entity ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…