Skip to content

Commit

Permalink
fix: property info caching if another bundle is decorating cache
Browse files Browse the repository at this point in the history
  • Loading branch information
priyadi committed Apr 24, 2024
1 parent 84d74f7 commit 81db364
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 18 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# CHANGELOG

## 1.1.2

* fix: property info caching if another bundle is decorating cache ([#47](https://github.com/rekalogika/mapper/issues/47))

## 1.1.1

* fix: Fix missing `kernel.reset` tags.
Expand Down
36 changes: 36 additions & 0 deletions config/non-debug.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

declare(strict_types=1);

/*
* This file is part of rekalogika/mapper package.
*
* (c) Priyadi Iman Nurcahyo <https://rekalogika.dev>
*
* For the full copyright and license information, please view the LICENSE file
* that was distributed with this source code.
*/

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symfony\Component\PropertyInfo\PropertyInfoCacheExtractor;

use function Symfony\Component\DependencyInjection\Loader\Configurator\service;

return static function (ContainerConfigurator $containerConfigurator): void {
$services = $containerConfigurator->services();

dump(123);

$services
->set('rekalogika.mapper.cache.property_info')
->parent('cache.system')
->tag('cache.pool');

$services
->set('rekalogika.mapper.property_info.cache', PropertyInfoCacheExtractor::class)
->decorate('rekalogika.mapper.property_info')
->args([
service('rekalogika.mapper.property_info.cache.inner'),
service('rekalogika.mapper.cache.property_info')
]);
};
13 changes: 0 additions & 13 deletions config/services.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,6 @@

]);

$services
->set('rekalogika.mapper.cache.property_info')
->parent('cache.system')
->tag('cache.pool');

$services
->set('rekalogika.mapper.property_info.cache', PropertyInfoCacheExtractor::class)
->decorate('rekalogika.mapper.property_info')
->args([
service('rekalogika.mapper.property_info.cache.inner'),
service('rekalogika.mapper.cache.property_info')
]);

# transformers

$services
Expand Down
5 changes: 0 additions & 5 deletions src/DependencyInjection/CompilerPass/DebugPass.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@
{
public function process(ContainerBuilder $container): void
{
// remove property info cache

$container->removeDefinition('rekalogika.mapper.cache.property_info');
$container->removeDefinition('rekalogika.mapper.property_info.cache');

// decorates all transformers using TraceableTransformer

$dataCollector = new Reference('rekalogika.mapper.data_collector');
Expand Down
2 changes: 2 additions & 0 deletions src/DependencyInjection/RekalogikaMapperExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ public function load(array $configs, ContainerBuilder $container): void

if ($debug) {
$loader->load('debug.php');
} else {
$loader->load('non-debug.php');
}

// autoconfiguration
Expand Down

0 comments on commit 81db364

Please sign in to comment.