Lines Matching refs:copy
8 [![Total Downloads](https://poser.pugx.org/myclabs/deep-copy/downloads.svg)](https://packagist.org/packages/myclabs/deep-copy)
41 composer require myclabs/deep-copy
50 $myCopy = $copier->copy($myObject);
86 ![With DeepCopy](doc/deep-copy.png)
99 $copy = deep_copy($var);
109 $copy = $copier->copy($var);
112 You may want to roll your own deep copy function:
127 return $copier->copy($var);
134 You can add filters to customize the copy process.
194 Let's say for example that you are copying a database record (or a Doctrine entity), so you want the copy not to have
208 $copy = $copier->copy($object);
210 echo $copy->id; // null
226 $copy = $copier->copy($object);
227 // $copy->category has not been touched
233 If you use Doctrine and want to copy an entity, you will need to use the `DoctrineCollectionFilter`:
243 $copy = $copier->copy($object);
249 If you use Doctrine and want to copy an entity who contains a `Collection` that you want to be reset, you can use the
260 $copy = $copier->copy($object);
262 // $copy->myProperty will return an empty collection
282 $copy = $copier->copy($object);
284 // $copy should now contain a clone of all entities, including those that were not yet fully loaded.
299 return $currentValue . ' (copy)'
303 $copy = $copier->copy($object);
305 // $copy->title will contain the data returned by the callback, e.g. 'The title (copy)'
321 $copy = $copier->copy([new MyClass, 'some string', new MyClass]);
323 // $copy will contain ['MyClass', 'some string', 'MyClass']
375 Get professional support via [the Tidelift Subscription](https://tidelift.com/subscription/pkg/packagist-myclabs-deep-copy?utm_source=packagist-myclabs-deep-copy&utm_medium=referral&utm_campaign=readme).