Skip to content

Instantly share code, notes, and snippets.

@lenybernard
Last active December 31, 2015 18:09
Show Gist options
  • Select an option

  • Save lenybernard/8024870 to your computer and use it in GitHub Desktop.

Select an option

Save lenybernard/8024870 to your computer and use it in GitHub Desktop.
<?php
public function process(ContainerBuilder $container)
{
if (!$container->hasDefinition('jms_translation.config_factory')) {
error_log('jms_translation.config_factory not exists');
return;
}
$definition = $container->getDefinition('jms_translation.config_factory');
$victoireBasePath = $container->getParameterBag()->get('kernel.root_dir').'/../src/Victoire';
$finder = new Finder();
$finder->directories()->in($victoireBasePath)->depth(' == 0');
$requests = array();
foreach ($finder as $bundle) {
$def = new Definition('JMS\TranslationBundle\Translation\ConfigBuilder');
$def->addMethodCall('setTranslationsDir', array($victoireBasePath."/".$bundle->getFilename().'/Resources/translations'));
$def->addMethodCall('setScanDirs', array(array($victoireBasePath."/".$bundle->getFilename())));
$definition->addMethodCall(
'addBuilder',
array($bundle->getFilename(), $def)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment