Skip to content

Commit

Permalink
fix: uuid packages are now not required (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
priyadi committed May 30, 2024
1 parent 78c8420 commit cf93ac2
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

* feat: utilize `InheritanceMap` on the source side to determine the target
class
* fix: uuid packages are now not required

## 1.4.0

Expand Down
20 changes: 13 additions & 7 deletions config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
* that was distributed with this source code.
*/

use Ramsey\Uuid\UuidInterface;
use Rekalogika\Mapper\Command\MappingCommand;
use Rekalogika\Mapper\Command\TryCommand;
use Rekalogika\Mapper\Command\TryPropertyCommand;
Expand Down Expand Up @@ -69,6 +70,7 @@
use Symfony\Component\PropertyInfo\PropertyInfoExtractor;
use Symfony\Component\PropertyInfo\PropertyReadInfoExtractorInterface;
use Symfony\Component\PropertyInfo\PropertyWriteInfoExtractorInterface;
use Symfony\Component\Uid\Factory\UuidFactory;

use function Symfony\Component\DependencyInjection\Loader\Configurator\param;
use function Symfony\Component\DependencyInjection\Loader\Configurator\service;
Expand Down Expand Up @@ -127,13 +129,17 @@
->set(StringToBackedEnumTransformer::class)
->tag('rekalogika.mapper.transformer', ['priority' => -500]);

$services
->set(SymfonyUidTransformer::class)
->tag('rekalogika.mapper.transformer', ['priority' => -550]);

$services
->set(RamseyUuidTransformer::class)
->tag('rekalogika.mapper.transformer', ['priority' => -550]);
if (class_exists(UuidFactory::class)) {
$services
->set(SymfonyUidTransformer::class)
->tag('rekalogika.mapper.transformer', ['priority' => -550]);
}

if (interface_exists(UuidInterface::class)) {
$services
->set(RamseyUuidTransformer::class)
->tag('rekalogika.mapper.transformer', ['priority' => -550]);
}

$services
->set(ObjectToStringTransformer::class)
Expand Down

0 comments on commit cf93ac2

Please sign in to comment.