Alter part of Symfony Configuration TreeBuilder

152 Views Asked by At

I have a parent configuration specification

GenericDatabaseAdapterConfiguration implements ConfigurationInterface

It has some default values - host, user and password. Then there are children that have their specific configuration options.

MySQLDatabaseAdapterConfiguration extends GenericDatabaseAdapterConfiguration

It has charset option, that MSSQLDatabaseAdapterConfiguration does not have.

What would be a good way to alter the existing TreeBuilder that is returned from GenericDatabaseAdapterConfiguration::getConfigTreeBuilder(). Ideally I would like something like parent::getConfigTreeBuilder()->appendTo('parameters', $mssqlCustomSettingsNode);, but that does not exist.

So far I created extension points inside the Generic class. $this->append($this->getSshTunnelConnectionParametersNode()) is called inside the tree and empty method getSshTunnelConnectionParametersNode is inside the generic class that can be overridden in children. But that is not ideal as I need to anticipate every possible point of extension in the Generic class.

Is there a better way?

0

There are 0 best solutions below