1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-07-31 22:10:45 +02:00

[ticket/15987] Go back to previous table definition type

This will still allow using the 'tables' parameter array but will also ensure
full backward compatibility and compatibility with extensions that will add
more tables to the 'tables' array.

PHPBB3-15987
This commit is contained in:
Marc Alexander
2019-05-14 21:20:51 +02:00
parent 61fa4f006a
commit d72498a9c3
7 changed files with 115 additions and 93 deletions

View File

@@ -22,26 +22,27 @@ use Symfony\Component\HttpKernel\DependencyInjection\Extension;
class tables extends Extension
{
/**
* Loads a specific configuration.
*
* @param array $configs An array of configuration values
* @param ContainerBuilder $container A ContainerBuilder instance
*
* @throws \InvalidArgumentException When provided tag is not defined in this extension
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
{
if (!$container->hasParameter('tables'))
// Tables is a reserved parameter and will be overwritten at all times
$tables = [];
// Add access via 'tables' parameter to acquire array with all tables
$parameterBag = $container->getParameterBag();
$parameters = $parameterBag->all();
foreach ($parameters as $parameter_name => $parameter_value)
{
return;
if (!preg_match('/tables\.(.+)/', $parameter_name, $matches))
{
continue;
}
$tables[$matches[1]] = $parameter_value;
}
$tables = $container->getParameter('tables');
foreach ($tables as $table_name => $table_value)
{
$container->setParameter('tables.' . $table_name, $table_value);
}
$container->setParameter('tables', $tables);
}
/**