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

Popular posts from this blog

'hasOwnProperty' in javascript -

python - ValueError: No axis named 1 for object type <class 'pandas.core.series.Series'> -

Command prompt result in label. Python 2.7 -