Skip to content

Commit

Permalink
update dependency injection configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiabasone committed Nov 30, 2021
1 parent f04629e commit 97922a0
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
8 changes: 0 additions & 8 deletions src/PatchManager/Bundle/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,6 @@ public function getConfigTreeBuilder(): TreeBuilder
->arrayNode('handlers')
->addDefaultsIfNotSet()
->children()
->arrayNode('data')
->addDefaultsIfNotSet()
->children()
->scalarNode('entity_manager')->defaultValue('default')->end()
->scalarNode('doctrine')->defaultTrue()->end()
->scalarNode('magic_call')->defaultFalse()->end()
->end()
->end()
->scalarNode('state_machine')->end()
->end()
->end()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,36 +54,12 @@ private function handleGenericConfig(
if (!is_null($config['alias'])) {
$container->setAlias($config['alias'], 'patch_manager');
}
if (array_key_exists('data', $config['handlers'])) {
$this->handleData($config, $loaderHandlers, $container);
}
if (array_key_exists('state_machine', $config['handlers'])) {
$this->handleStateMachine($loaderHandlers, $container);
}
$container->setParameter('patch_manager.strict_mode', $config['strict_mode']);
}

/**
* @param array $config
* @param Loader\XmlFileLoader $loaderHandlers
* @param ContainerBuilder $container
*/
private function handleData(array $config, Loader\XmlFileLoader $loaderHandlers, ContainerBuilder $container): void
{
if ($config['handlers']['data']['doctrine']) {
$loaderHandlers->load('data_doctrine.xml');
$doctrineEMName = sprintf('doctrine.orm.%s_entity_manager', $config['handlers']['data']['entity_manager']);
$dataDoctrineDefinition = $container->getDefinition('patch_manager.handler.data');
$dataDoctrineDefinition->addArgument(
new Reference($doctrineEMName)
);
} else {
$loaderHandlers->load('data.xml');
}
$dataHandlerDefinition = $container->getDefinition('patch_manager.handler.data');
$dataHandlerDefinition->addTag('patch_manager.handler');
}

/**
* @param Loader\XmlFileLoader $loaderHandlers
* @param ContainerBuilder $container
Expand Down

0 comments on commit 97922a0

Please sign in to comment.