Skip to content

Commit 02c20ba

Browse files
committed
[FrameworkBundle] object mapper service definition without form
1 parent 94f4d7a commit 02c20ba

File tree

5 files changed

+29
-8
lines changed

5 files changed

+29
-8
lines changed

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -642,6 +642,14 @@ public function load(array $configs, ContainerBuilder $container): void
642642
$loader->load('mime_type.php');
643643
}
644644

645+
if (ContainerBuilder::willBeAvailable('symfony/object-mapper', ObjectMapperInterface::class, ['symfony/framework-bundle'])) {
646+
$loader->load('object_mapper.php');
647+
$container->registerForAutoconfiguration(TransformCallableInterface::class)
648+
->addTag('object_mapper.transform_callable');
649+
$container->registerForAutoconfiguration(ConditionCallableInterface::class)
650+
->addTag('object_mapper.condition_callable');
651+
}
652+
645653
$container->registerForAutoconfiguration(PackageInterface::class)
646654
->addTag('assets.package');
647655
$container->registerForAutoconfiguration(AssetCompilerInterface::class)
@@ -880,14 +888,6 @@ private function registerFormConfiguration(array $config, ContainerBuilder $cont
880888
if (!ContainerBuilder::willBeAvailable('symfony/translation', Translator::class, ['symfony/framework-bundle', 'symfony/form'])) {
881889
$container->removeDefinition('form.type_extension.upload.validator');
882890
}
883-
884-
if (ContainerBuilder::willBeAvailable('symfony/object-mapper', ObjectMapperInterface::class, ['symfony/framework-bundle'])) {
885-
$loader->load('object_mapper.php');
886-
$container->registerForAutoconfiguration(TransformCallableInterface::class)
887-
->addTag('object_mapper.transform_callable');
888-
$container->registerForAutoconfiguration(ConditionCallableInterface::class)
889-
->addTag('object_mapper.condition_callable');
890-
}
891891
}
892892

893893
private function registerHttpCacheConfiguration(array $config, ContainerBuilder $container, bool $httpMethodOverride): void
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
<?php
2+
3+
$container->loadFromExtension('framework', [
4+
]);
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<container xmlns="http://symfony.com/schema/dic/services"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xmlns:framework="http://symfony.com/schema/dic/symfony"
5+
xsi:schemaLocation="http://symfony.com/schema/dic/services https://symfony.com/schema/dic/services/services-1.0.xsd
6+
http://symfony.com/schema/dic/symfony https://symfony.com/schema/dic/symfony/symfony-1.0.xsd">
7+
8+
<framework:config>
9+
</framework:config>
10+
</container>
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
framework:

src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTestCase.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2600,6 +2600,12 @@ public function testJsonStreamerEnabled()
26002600
$this->assertTrue($container->has('json_streamer.stream_writer'));
26012601
}
26022602

2603+
public function testObjectMapperEnabled()
2604+
{
2605+
$container = $this->createContainerFromFile('object_mapper');
2606+
$this->assertTrue($container->has('object_mapper'));
2607+
}
2608+
26032609
protected function createContainer(array $data = [])
26042610
{
26052611
return new ContainerBuilder(new EnvPlaceholderParameterBag(array_merge([

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy