Add behaviors section in configuration
This commit is contained in:
parent
69cbd01fcc
commit
9efcc3e83e
|
@ -62,6 +62,9 @@ class Configuration implements ConfigurationInterface
|
|||
* build_properties:
|
||||
* xxxx.xxxx: xxxxxx
|
||||
* ...
|
||||
* behaviors:
|
||||
* fooable: My\FooableBehavior
|
||||
* barable: src.barable.BarableBehavior
|
||||
*/
|
||||
private function addGeneralSection(ArrayNodeDefinition $node)
|
||||
{
|
||||
|
@ -74,6 +77,10 @@ class Configuration implements ConfigurationInterface
|
|||
->useAttributeAsKey('key')
|
||||
->prototype('scalar')->end()
|
||||
->end()
|
||||
->arrayNode('behaviors')
|
||||
->useAttributeAsKey('key')
|
||||
->prototype('scalar')->end()
|
||||
->end()
|
||||
;
|
||||
}
|
||||
|
||||
|
|
|
@ -75,12 +75,20 @@ class PropelExtension extends Extension
|
|||
$loader->load('converters.xml');
|
||||
}
|
||||
|
||||
// build properties
|
||||
if (isset($config['build_properties']) && is_array($config['build_properties'])) {
|
||||
$buildProperties = $config['build_properties'];
|
||||
} else {
|
||||
$buildProperties = array();
|
||||
}
|
||||
|
||||
// behaviors
|
||||
if (isset($config['behaviors']) && is_array($config['behaviors'])) {
|
||||
foreach ($config['behaviors'] as $name => $class) {
|
||||
$buildProperties[sprintf('propel.behavior.%s.class', $name)] = $class;
|
||||
}
|
||||
}
|
||||
|
||||
$container->getDefinition('propel.build_properties')->setArguments(array($buildProperties));
|
||||
|
||||
if (!empty($config['dbal'])) {
|
||||
|
@ -145,16 +153,6 @@ class PropelExtension extends Extension
|
|||
return __DIR__.'/../Resources/config/schema';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the namespace to be used for this extension (XML namespace).
|
||||
*
|
||||
* @return string The XML namespace
|
||||
*/
|
||||
public function getNamespace()
|
||||
{
|
||||
return 'http://www.symfony-project.org/schema/dic/propel';
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the recommended alias to use in XML.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue