[AsseticBundle] updated bundle node to match others, cleaned up validation

This commit is contained in:
Kris Wallsmith 2011-04-13 05:13:04 -07:00
parent 6c8e4a567c
commit bfb0f094f4
3 changed files with 18 additions and 13 deletions

View File

@ -6,6 +6,20 @@ one. It only discusses changes that need to be done when using the "public"
API of the framework. If you "hack" the core, you should probably follow the
timeline closely anyway.
PR11 to PR12
------------
* AsseticBundle's XML `bundle` node has been normalized to match other similar
nodes
Before:
<bundle name="MyBundle" />
After:
<bundle>MyBundle</bundle>
PR10 to PR11
------------

View File

@ -115,12 +115,7 @@ class AsseticExtension extends Extension
static protected function registerFormulaResources(ContainerBuilder $container, array $bundles)
{
$map = $container->getParameter('kernel.bundles');
if ($diff = array_diff($bundles, array_keys($map))) {
throw new \InvalidArgumentException(sprintf('The following bundles are not registered: "%s"', implode('", "', $diff)));
}
$am = $container->getDefinition('assetic.asset_manager');
$am = $container->getDefinition('assetic.asset_manager');
// bundle views/ directories and kernel overrides
foreach ($bundles as $name) {

View File

@ -66,14 +66,10 @@ class Configuration implements ConfigurationInterface
->arrayNode('bundles')
->defaultValue($this->bundles)
->requiresAtLeastOneElement()
->beforeNormalization()
->ifTrue(function($v) { return !is_array($v); })
->then(function($v) { return array($v); })
->end()
->prototype('scalar')
->beforeNormalization()
->ifTrue(function($v) { return is_array($v) && isset($v['name']); })
->then(function($v) { return $v['name']; })
->validate()
->ifNotInArray($this->bundles)
->thenInvalid('%s is not a valid bundle.')
->end()
->end()
->end()