Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: property info caching if another bundle is decorating cache #50

Merged
merged 1 commit into from
Apr 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading