symfony - clone doctrine ArrayCollection without reference -
when
$originaltags = $task->gettags(); $task->removetag($tag1);
then $tag1
removed in $originaltags
. assignment of arraycollections made reference, how can clone new arraycollection?
you can use native php clone
object cloning.
$originaltags = $task->gettags(); $task2 = clone $task; $task2->removetag($tag1);
Comments
Post a Comment