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

javascript - Confirm a form & display message if form is valid with JQuery -

Retrieving ETA (estimated time of arrival) with Google Distance Matrix API and public transit as transport mode -

ionic framework - Meteor - Error: Failed to execute 'insertBefore' on 'Node' -