PHP code example of mickprev / duplicator

1. Go to this page and download the library: Download mickprev/duplicator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

mickprev / duplicator example snippets


use MickPrev\Duplicator\Annotation\Groups;

class Product
{
    // ...
    /**
      * @Groups({"my_group"})
      */
     private $title;
    // ...
}

$duplicator = new ChainDuplicator(
    [
        new IterableDuplicator(),
        new ObjectDuplicator(),
        new DefaultDuplicator(),
    ]
);

$newProduct = $duplicator->duplicate($originalProduct, ['groups' => ['my_group']]);