Skip to content

Commit

Permalink
refactor: remove property processor for easier future optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
priyadi committed Oct 23, 2024
1 parent d7d7bd3 commit 9c9de1e
Show file tree
Hide file tree
Showing 10 changed files with 547 additions and 802 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## 1.13.2

* feat: `Map` now accepts false, for the more expressive `#[Map(false)]`
* refactor: remove property processor for easier future optimization

## 1.13.1

Expand Down
26 changes: 0 additions & 26 deletions config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,6 @@
use Rekalogika\Mapper\Transformer\ObjectToObjectMetadata\Implementation\ObjectToObjectMetadataFactory;
use Rekalogika\Mapper\Transformer\ObjectToObjectMetadata\Implementation\ProxyResolvingObjectToObjectMetadataFactory;
use Rekalogika\Mapper\TransformerProcessor\ObjectProcessor\DefaultObjectProcessorFactory;
use Rekalogika\Mapper\TransformerProcessor\PropertyProcessor\CachingPropertyProcessorFactory;
use Rekalogika\Mapper\TransformerProcessor\PropertyProcessor\DefaultPropertyProcessorFactory;
use Rekalogika\Mapper\TransformerRegistry\Implementation\CachingTransformerRegistry;
use Rekalogika\Mapper\TransformerRegistry\Implementation\TransformerRegistry;
use Rekalogika\Mapper\TypeResolver\Implementation\CachingTypeResolver;
Expand Down Expand Up @@ -391,30 +389,6 @@
'$subMapperFactory' => service('rekalogika.mapper.sub_mapper.factory'),
'$proxyFactory' => service('rekalogika.mapper.proxy.factory'),
'$propertyAccessor' => service(PropertyAccessorInterface::class),
'$propertyProcessorFactory' => service('rekalogika.mapper.transformer_processor.property_processor_factory'),
]);

# transformer processor, property processor factory

$services
->set(
'rekalogika.mapper.transformer_processor.property_processor_factory',
DefaultPropertyProcessorFactory::class,
)
->args([
'$propertyAccessor' => service(PropertyAccessorInterface::class),
'$subMapperFactory' => service('rekalogika.mapper.sub_mapper.factory'),
'$propertyMapperLocator' => tagged_locator('rekalogika.mapper.property_mapper'),
]);

$services
->set(
'rekalogika.mapper.transformer_processor.property_processor_factory.caching',
CachingPropertyProcessorFactory::class,
)
->decorate('rekalogika.mapper.transformer_processor.property_processor_factory')
->args([
service('.inner'),
]);

# sub mapper
Expand Down
17 changes: 0 additions & 17 deletions src/MapperFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@
use Rekalogika\Mapper\Transformer\TransformerInterface;
use Rekalogika\Mapper\TransformerProcessor\ObjectProcessor\DefaultObjectProcessorFactory;
use Rekalogika\Mapper\TransformerProcessor\ObjectProcessorFactoryInterface;
use Rekalogika\Mapper\TransformerProcessor\PropertyProcessor\CachingPropertyProcessorFactory;
use Rekalogika\Mapper\TransformerProcessor\PropertyProcessor\DefaultPropertyProcessorFactory;
use Rekalogika\Mapper\TransformerProcessor\PropertyProcessorFactoryInterface;
use Rekalogika\Mapper\TransformerRegistry\Implementation\TransformerRegistry;
use Rekalogika\Mapper\TransformerRegistry\TransformerRegistryInterface;
use Rekalogika\Mapper\TypeResolver\Implementation\CachingTypeResolver;
Expand Down Expand Up @@ -204,8 +201,6 @@ class MapperFactory

private ?ObjectProcessorFactoryInterface $objectProcessorFactory = null;

private ?PropertyProcessorFactoryInterface $propertyProcessorFactory = null;

private ?MappingCommand $mappingCommand = null;

private ?TryCommand $tryCommand = null;
Expand Down Expand Up @@ -912,18 +907,6 @@ protected function getObjectProcessorFactory(): ObjectProcessorFactoryInterface
subMapperFactory: $this->getSubMapperFactory(),
proxyFactory: $this->getProxyFactory(),
propertyAccessor: $this->getPropertyAccessor(),
propertyProcessorFactory: $this->getPropertyProcessorFactory(),
);
}

protected function getPropertyProcessorFactory(): PropertyProcessorFactoryInterface
{
return $this->propertyProcessorFactory ??= new CachingPropertyProcessorFactory(
new DefaultPropertyProcessorFactory(
propertyAccessor: $this->getPropertyAccessor(),
subMapperFactory: $this->getSubMapperFactory(),
propertyMapperLocator: $this->getPropertyMapperLocator(),
),
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
use Rekalogika\Mapper\Transformer\ObjectToObjectMetadata\ObjectToObjectMetadata;
use Rekalogika\Mapper\TransformerProcessor\ObjectProcessorFactoryInterface;
use Rekalogika\Mapper\TransformerProcessor\ObjectProcessorInterface;
use Rekalogika\Mapper\TransformerProcessor\PropertyProcessorFactoryInterface;
use Symfony\Component\PropertyAccess\PropertyAccessorInterface;

/**
Expand All @@ -35,7 +34,6 @@ public function __construct(
private readonly SubMapperFactoryInterface $subMapperFactory,
private readonly ProxyFactoryInterface $proxyFactory,
private readonly PropertyAccessorInterface $propertyAccessor,
private readonly PropertyProcessorFactoryInterface $propertyProcessorFactory,
) {}

public function getObjectProcessor(
Expand All @@ -48,8 +46,6 @@ public function getObjectProcessor(
subMapperFactory: $this->subMapperFactory,
proxyFactory: $this->proxyFactory,
propertyAccessor: $this->propertyAccessor,
propertyProcessorFactory: $this->propertyProcessorFactory
->withMainTransformer($this->getMainTransformer()),
);
}
}
Loading

0 comments on commit 9c9de1e

Please sign in to comment.