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

Command prompt result in label. Python 2.7 -

javascript - How do I use URL parameters to change link href on page? -

amazon web services - AWS Route53 Trying To Get Site To Resolve To www -