[AsseticBundle] updated bundle node to match others, cleaned up validation
This commit is contained in:
parent
6c8e4a567c
commit
bfb0f094f4
14
UPDATE.md
14
UPDATE.md
@ -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
|
API of the framework. If you "hack" the core, you should probably follow the
|
||||||
timeline closely anyway.
|
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
|
PR10 to PR11
|
||||||
------------
|
------------
|
||||||
|
|
||||||
|
@ -115,12 +115,7 @@ class AsseticExtension extends Extension
|
|||||||
static protected function registerFormulaResources(ContainerBuilder $container, array $bundles)
|
static protected function registerFormulaResources(ContainerBuilder $container, array $bundles)
|
||||||
{
|
{
|
||||||
$map = $container->getParameter('kernel.bundles');
|
$map = $container->getParameter('kernel.bundles');
|
||||||
|
$am = $container->getDefinition('assetic.asset_manager');
|
||||||
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');
|
|
||||||
|
|
||||||
// bundle views/ directories and kernel overrides
|
// bundle views/ directories and kernel overrides
|
||||||
foreach ($bundles as $name) {
|
foreach ($bundles as $name) {
|
||||||
|
@ -66,14 +66,10 @@ class Configuration implements ConfigurationInterface
|
|||||||
->arrayNode('bundles')
|
->arrayNode('bundles')
|
||||||
->defaultValue($this->bundles)
|
->defaultValue($this->bundles)
|
||||||
->requiresAtLeastOneElement()
|
->requiresAtLeastOneElement()
|
||||||
->beforeNormalization()
|
|
||||||
->ifTrue(function($v) { return !is_array($v); })
|
|
||||||
->then(function($v) { return array($v); })
|
|
||||||
->end()
|
|
||||||
->prototype('scalar')
|
->prototype('scalar')
|
||||||
->beforeNormalization()
|
->validate()
|
||||||
->ifTrue(function($v) { return is_array($v) && isset($v['name']); })
|
->ifNotInArray($this->bundles)
|
||||||
->then(function($v) { return $v['name']; })
|
->thenInvalid('%s is not a valid bundle.')
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
->end()
|
->end()
|
||||||
|
Reference in New Issue
Block a user