Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Prev Previous commit
Next Next commit
implement feedback
  • Loading branch information
vicb committed Jan 24, 2013
commit ccbabffbf1a2e0fe022cc78261b86effc53668cc
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,10 @@ private function registerFormConfiguration($config, ContainerBuilder $container,
}
$loader->load('form_csrf.xml');

$container->setParameter('form.type_extension.csrf.enabled', $config['csrf_protection']['enabled']);
$container->setParameter('form.type_extension.csrf.enabled', true);
$container->setParameter('form.type_extension.csrf.field_name', $config['csrf_protection']['field_name']);
} else {
$container->setParameter('form.type_extension.csrf.enabled', false);
}
}

Expand Down Expand Up @@ -203,6 +205,8 @@ private function registerRouterProxyConfiguration(array $config, ContainerBuilde
private function registerProfilerConfiguration(array $config, ContainerBuilder $container, XmlFileLoader $loader)
{
if (!$this->isConfigEnabled($container, $config)) {
$container->getDefinition('profiler')->addMethodCall('disable', array());

return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this doesn't harmonize with what is done in line 254:

if (!$config['enabled']) {
    $container->getDefinition('profiler')->addMethodCall('disable', array());
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Tobion could you submit a PR please ?

}

Expand Down Expand Up @@ -250,10 +254,6 @@ private function registerProfilerConfiguration(array $config, ContainerBuilder $
}
}
}

if (!$config['enabled']) {
$container->getDefinition('profiler')->addMethodCall('disable', array());
}
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Config/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ CHANGELOG
-----

* [BC BREAK] changed ArrayNodeDefinition::canBeEnabled() and ArrayNodeDefinition::canBeDisabled()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, this is not a BC break as those methods have been introduced in 2.2 (see #5688). So, this can be replaced with something like "added ArrayNodeDefinition::canBeEnabled() and ArrayNodeDefinition::canBeDisabled() to simplify optional configuration management"

to set the defaults when the node is not set - the methods were ineffective
to add the defaults when the node is not set - the methods were ineffective
if ArrayNodeDefinition::setDefaultsIfNotSet() was not explicitely called.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small typo here add not set.

Regarding the change itself, it seems fine to me.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the review, I'll update tomorrow

* added a `normalizeKeys()` method for array nodes (to avoid key normalization)
* added numerical type handling for config definitions
Expand Down
1 change: 1 addition & 0 deletions src/Symfony/Component/DependencyInjection/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ CHANGELOG
2.2.0
-----

* added Extension::isConfigEnabled() to ease working with enableable configurations
* added an Extension base class with sensible defaults to be used in conjunction
with the Config component.
* added PrependExtensionInterface (to be able to allow extensions to prepend
Expand Down