#!/usr/bin/env php
<?php


// if you don't want to setup permissions the proper way, just uncomment the following PHP line
// read http://symfony.com/doc/current/book/installation.html#configuration-and-setup for more information
//umask(0000);

use Symfony\Component\Config\FileLocator;
use Symfony\Component\Console\Application;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;

set_time_limit(0);

/**
 * @var Composer\Autoload\ClassLoader
 */
$loader = require __DIR__ . '/../vendor/autoload.php';

$container = new ContainerBuilder();
$container->register('tactician.commandbus', \League\Tactician\CommandBus::class)->addArgument([]);

$loader = new YamlFileLoader($container, new FileLocator([__DIR__ . '/../src/IssetBV/TalosBundle/Resources/config']));
$loader->load('services.yml');
$loader = new YamlFileLoader($container, new FileLocator([__DIR__ . '/../src/IssetBV/PaymentBundle/Resources/config']));
$loader->load('services.yml');
$loader = new YamlFileLoader($container, new FileLocator([__DIR__ . '/../vendor/league/tactician-bundle/Resources/config/services']));
$loader->load('services.yml');

$application = new Application('talos', '1.0.0');

$container->compile();

foreach ($container->findTaggedServiceIds('console.command') as $taggedServiceId => $something) {
    $application->add($container->get($taggedServiceId));
}

$application->run();
