Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add behaviors section in configuration

  • Loading branch information...
commit 9efcc3e83eed8e9557fa3f64589d3a69088229d5 1 parent 69cbd01
@willdurand willdurand authored
View
7 DependencyInjection/Configuration.php
@@ -62,6 +62,9 @@ public function getConfigTreeBuilder()
* build_properties:
* xxxx.xxxx: xxxxxx
* ...
+ * behaviors:
+ * fooable: My\FooableBehavior
+ * barable: src.barable.BarableBehavior
*/
private function addGeneralSection(ArrayNodeDefinition $node)
{
@@ -74,6 +77,10 @@ private function addGeneralSection(ArrayNodeDefinition $node)
->useAttributeAsKey('key')
->prototype('scalar')->end()
->end()
+ ->arrayNode('behaviors')
+ ->useAttributeAsKey('key')
+ ->prototype('scalar')->end()
+ ->end()
;
}
View
18 DependencyInjection/PropelExtension.php
@@ -75,12 +75,20 @@ public function load(array $configs, ContainerBuilder $container)
$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'])) {
@@ -146,16 +154,6 @@ public function getXsdValidationBasePath()
}
/**
- * 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.
*
* This alias is also the mandatory prefix to use when using YAML.
Please sign in to comment.
Something went wrong with that request. Please try again.