Commit f0607ff7 authored by Jon Pugh's avatar Jon Pugh

Move Aegir\Provision\ServerContext\getConfigTreeBuilder to parent class for...

Move Aegir\Provision\ServerContext\getConfigTreeBuilder to parent class for automated config building from options_documentation() method.
parent 84ac79c2
......@@ -6,6 +6,7 @@
namespace Aegir\Provision;
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
use Symfony\Component\Config\Definition\Processor;
use Symfony\Component\Filesystem\Exception\IOException;
use Symfony\Component\Filesystem\Filesystem;
......@@ -74,7 +75,34 @@ class Context
);
}
}
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
$tree_builder = new TreeBuilder();
$root_node = $tree_builder->root('server');
$root_node
->children()
->scalarNode('name')
->defaultValue($this->name)
->end()
->end();
// @TODO: Figure out how we can let other classes add to Context properties.
foreach ($this->option_documentation() as $name => $description) {
$root_node
->children()
->scalarNode($name)
->defaultValue($this->properties[$name])
->end()
->end();
}
return $tree_builder;
}
/**
* Return all properties for this context.
*
......
......@@ -32,32 +32,4 @@ class ServerContext extends Context implements ConfigurationInterface
return $options;
}
/**
* {@inheritdoc}
*/
public function getConfigTreeBuilder()
{
$tree_builder = new TreeBuilder();
$root_node = $tree_builder->root('server');
$root_node
->children()
->scalarNode('name')
->defaultValue($this->name)
->end()
->end();
// @TODO: Figure out how we can let other classes add to ServerContext properties.
foreach (self::option_documentation() as $name => $description) {
$root_node
->children()
->scalarNode($name)
->defaultValue($this->properties[$name])
->end()
->end();
}
return $tree_builder;
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment