diff --git a/DependencyInjection/Configuration.php b/DependencyInjection/Configuration.php index dcd612c..0c0006c 100644 --- a/DependencyInjection/Configuration.php +++ b/DependencyInjection/Configuration.php @@ -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() ; } diff --git a/DependencyInjection/PropelExtension.php b/DependencyInjection/PropelExtension.php index ffc87d9..3daf950 100644 --- a/DependencyInjection/PropelExtension.php +++ b/DependencyInjection/PropelExtension.php @@ -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. *