[2.3] [FrameworkBundle] [Serializer] Loads the Serializer component as a service in the Framework Bundle #6815

Merged
merged 1 commit into from Mar 23, 2013

Projects

None yet

8 participants

@loalf
Contributor
loalf commented Jan 20, 2013

This PR is the same as
#5347

but since I am struggling to squash all the commits I better create a new one. Sorry for the inconveniences, :)

@stloyd stloyd and 1 other commented on an outdated diff Jan 20, 2013
...workBundle/DependencyInjection/FrameworkExtension.php
@@ -112,6 +112,10 @@ public function load(array $configs, ContainerBuilder $container)
$this->registerAnnotationsConfiguration($config['annotations'], $container, $loader);
+ if (isset($config['serializer'])) {
+ $this->registerSerializerConfiguration($config['serializer'], $loader);
@stloyd
stloyd Jan 20, 2013 Contributor

There is no point for such method, that do nothing more than one if check...

@fabpot
fabpot Jan 21, 2013 Member

I agree

@stloyd stloyd commented on an outdated diff Jan 20, 2013
...FrameworkBundle/DependencyInjection/Configuration.php
@@ -80,6 +80,7 @@ public function getConfigTreeBuilder()
$this->addTranslatorSection($rootNode);
$this->addValidationSection($rootNode);
$this->addAnnotationsSection($rootNode);
+ $this->addSerializerSection($rootNode);
@stloyd
stloyd Jan 20, 2013 Contributor

Wrong indent.

@fabpot fabpot commented on an outdated diff Jan 21, 2013
src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md
@@ -17,6 +17,7 @@ CHANGELOG
* replaced Symfony\Bundle\FrameworkBundle\Controller\TraceableControllerResolver by Symfony\Component\HttpKernel\Controller\TraceableControllerResolver
* replaced Symfony\Component\HttpKernel\Debug\ContainerAwareTraceableEventDispatcher by Symfony\Component\HttpKernel\Debug\TraceableEventDispatcher
* added Client::enableProfiler()
+ * added posibility to load the serializer component in the service container
@fabpot
fabpot Jan 21, 2013 Member

This should be the first line instead of being in the middle. That eases people who follow the CHANGELOG files.

@peterhorne

Thanks loalf! Any news on if / when this will be merged in?

@loalf
Contributor
loalf commented Feb 11, 2013

Thanks @peterhone. You better ask @fabpot or someone in the core.

@fabpot fabpot commented on an outdated diff Mar 23, 2013
...FrameworkBundle/DependencyInjection/Configuration.php
@@ -411,4 +412,16 @@ private function addAnnotationsSection(ArrayNodeDefinition $rootNode)
->end()
;
}
+
+ private function addSerializerSection(ArrayNodeDefinition $rootNode)
+ {
+ $rootNode
+ ->children()
+ ->arrayNode('serializer')
+ ->info('serializer configuration')
+ ->canBeDisabled()
@fabpot
fabpot Mar 23, 2013 Member

I would make it disabled by default. So, it should be canbeenabled here.

@loalf
Contributor
loalf commented Mar 23, 2013

@fabpot changed

@fabpot fabpot added a commit that referenced this pull request Mar 23, 2013
@fabpot fabpot merged branch loalf/add_serializer_service (PR #6815)
This PR was merged into the master branch.

Discussion
----------

[2.3] [FrameworkBundle] [Serializer] Loads the Serializer component as a service in the Framework Bundle

This PR is the same as
#5347

but since I am struggling to squash all the commits I better create a new one. Sorry for the inconveniences, :)

Commits
-------

b4e4844 Add the serializer service
9c4ba6f
@fabpot fabpot merged commit b4e4844 into symfony:master Mar 23, 2013

1 check passed

default Scrutinizer: No Comments — Travis: Passed
Details
@loalf loalf deleted the loalf:add_serializer_service branch Feb 3, 2014
@schmittjoh

You might want to check for the actual class of that service as someone might define his own serializer service, and not use the Symfony component.

As a workaround something like this is currently necessary:

services:
    serializer: @my_serializer
    my_serializer:
        public: false
        class: SomeClass
@Taluu

You should check if $sortedServices[$priority] is set (otherwise you may trigger a notice)

Member
stof replied Jan 3, 2015

no it won't. This is a write context, not a read one. So there is no notice.

@fabpot fabpot added a commit that referenced this pull request Dec 12, 2014
@fabpot fabpot feature #12295 [FrameworkBundle] make GetSetMethodNormalizer availabl…
…e by default (dunglas)

This PR was submitted for the master branch but it was merged into the 2.7 branch instead (closes #12295).

Discussion
----------

[FrameworkBundle] make GetSetMethodNormalizer available by default

| Q             | A
| ------------- | ---
| Bug fix?      | no
| New feature?  | yes
| BC breaks?    | very limited
| Deprecations? | no
| Tests pass?   | yes
| License       | MIT
| Doc PR        | not yet

The `GetSetMethodNormalizer` has not been enabled by default in #6815 because it was broken by design. Since #12098 has been merged, circular references are handled and that normalizer cannot breaks applications.
This PR makes that normalizer automatically available when the serializer is enabled. To keep BC, I've set a "high" priority for this service (higher than the default `0`).

Commits
-------

4f0aa61 [FrameworkBundle] make GetSetMethodNormalizer available by default
f47ade6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment