/**
* @param null $configPath
* @param array $configFilenames
*/
function __construct($configPath = null, $configFilenames = array())
{
$configPath = $configPath == null ? __DIR__ . '/../../../../../../app/config' : $configPath;
$this->container = new ContainerBuilder();
// Load app parameters and config files into container
$loader = new YamlFileLoader($this->container, new FileLocator($configPath));
$loader->load('parameters.yml');
foreach ($configFilenames as $filename) {
$loader->load($filename);
}
$appName = $this->container->getParameter('application_name');
$appVersion = $this->container->getParameter('application_version');
parent::__construct($appName, $appVersion);
// Set dispatcher definition, register listeners and subscribers
$dispatcherDef = $this->container->register('event_dispatcher', 'Symfony\\Component\\EventDispatcher\\ContainerAwareEventDispatcher');
$dispatcherDef->addArgument($this->container);
$this->registerEventListeners();
$this->container->compile();
// Once container is compiled we can get the event_dispatcher from dic
$this->dispatcher = $this->container->get('event_dispatcher');
// Add console commands (services console.command tagged)
foreach ($this->getTaggedCommands() as $id) {
$command = $this->container->get($id);
$this->add($command);
}
}