mickprev / duplicator
Library for duplicate an object (or an array of objects) using PHP annotations.
v1.0.0
2019-10-28 10:38 UTC
Requires
- php: >=7.2
- doctrine/annotations: ^1.7
- symfony/property-access: ^4.0
Requires (Dev)
- ext-pdo_sqlite: *
- beberlei/assert: ^3.2
- behat/behat: ^3.5
- doctrine/common: ^2.10
- doctrine/data-fixtures: ^1.3
- doctrine/doctrine-bundle: ^1.11
- doctrine/orm: ^2.6
- friends-of-behat/symfony-extension: ^2.0
- friendsofphp/php-cs-fixer: ^2.15
- phpstan/phpstan: ^0.11
- phpunit/phpunit: ^8.1
- symfony/framework-bundle: ^4.0
- symfony/serializer: ^4.0
This package is auto-updated.
Last update: 2024-11-28 22:09:13 UTC
README
Library for duplicate an object (or an array of objects) using PHP annotations.
Getting started
composer require mickprev/duplicator
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']]);
What the duplicator does not do yet
- Duplicate object with arguments in the constructor that have no default value.
- 'Iterable' duplicator returns a value with the same type that the value to duplicate instead of always return an array.