<?php
namespace LaunchPad\Bundle\LaunchPadBundle;
use LaunchPad\Bundle\LaunchPadBundle\Base\Service\Utils\Storage\DependencyInjection\Compiler\ResolveFileHandlerPass;
use LaunchPad\Bundle\LaunchPadBundle\DependencyInjection\LaunchPadExtension;
use Symfony\Component\Config\FileLocator;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\Extension\ExtensionInterface;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
class LaunchPadBundle extends Bundle
{
/**
* @param ContainerBuilder $container
* @throws \Exception
*/
public function build(ContainerBuilder $container)
{
$container->loadFromExtension('doctrine', [
'orm' => [
'mappings' => [
'LaunchPad' => [
'dir' => "{$this->getPath()}/Base/Entity",
'type' => 'annotation',
'prefix' => 'LaunchPad\Bundle\LaunchPadBundle\Base\Entity',
],
'Checkout' => [
'is_bundle' => false,
'dir' => "{$this->getPath()}/Base/Service/CardAquirer/Checkout/Entity",
'type' => 'annotation',
'prefix' => 'LaunchPad\Bundle\LaunchPadBundle\Base\Service\CardAquirer\Checkout\Entity',
],
'OTP' => [
'is_bundle' => false,
'dir' => "{$this->getPath()}/Base/Service/OTP/Entity",
'type' => 'annotation',
'prefix' => 'LaunchPad\Bundle\LaunchPadBundle\Base\Service\OTP\Entity',
],
]
],
'dbal' => [],
]);
$container->loadFromExtension('twig', [
'paths' => [
'%kernel.project_dir%/vendor/launchpad/backend/src/Resources/views' => 'WebsiteTemplates',
'%kernel.project_dir%/vendor/launchpad/backend/src/External/Resources/views' => 'ExternalTemplates',
// TODO: The OTP part could be loaded as module and move all this configuration there
'%kernel.project_dir%/vendor/launchpad/backend/src/Base/Service/OTP/Resources/views' => 'OTPTemplates',
],
]);
$container->loadFromExtension('framework', [
'default_locale' => 'en',
'translator' => ['default_path' => '%kernel.project_dir%/translations'],
// ...
]);
$loader = new YamlFileLoader(
$container,
new FileLocator($this->getPath().'/Resources/config')
);
$loader->load('services.yaml');
$loader->load('config.yaml');
$loader->load('security.yaml');
$loader->load('cors.yaml');
$loader->load('kyc.yaml');
$loader->load('email.yaml');
$loader->load('orm.yaml');
$loader->load('swiftmailer.yaml');
$loader->load('admin.yaml');
$uploadHandler = $container->getParameter('upload_handler') ? $container->getParameter('upload_handler') :'local';
// dump($uploadHandler);die;
$container->addCompilerPass(new ResolveFileHandlerPass($uploadHandler));
}
}