each module is available in the container with name module.ModuleName

This commit is contained in:
Manuel Raynaud
2013-09-06 11:43:37 +02:00
parent 2ef5e8bd0c
commit 1686d6d87c
5 changed files with 88 additions and 3 deletions

View File

@@ -33,8 +33,10 @@ namespace Thelia\Core;
*/
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Definition;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Validator\Tests\Fixtures\Reference;
use Symfony\Component\Yaml\Yaml;
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
@@ -107,6 +109,16 @@ class Thelia extends Kernel
foreach ($modules as $module) {
try {
$defintion = new Definition();
$defintion->setClass($module->getCode() ."\\". ucfirst($module->getCode()));
$defintion->addMethodCall("setContainer", array('service_container'));
$container->setDefinition(
"module.".$module->getCode(),
$defintion
);
$loader = new XmlFileLoader($container, new FileLocator(THELIA_MODULE_DIR . "/" . ucfirst($module->getCode()) . "/Config"));
$loader->load("config.xml");
} catch (\InvalidArgumentException $e) {