Esempio n. 1
0
 /**
  * __construct
  *
  * Constructs the object.
  *
  * @access public
  * @param  \Pimple $pimple
  * @return void
  */
 public function __construct(\Pimple $pimple)
 {
     $this->pimple = $pimple;
     $this->config = $pimple['config'];
     $this->setReporting();
     $appDir = $this->config['general.appDir'] . 'src';
     $appLoader = new Autoloader($this->config['general.namespace'], $appDir);
     $appLoader->register();
     $this->router = new Router($this->pimple);
     $this->session = $this->pimple['session'];
     $this->session->start();
     $this->session->set('language', $this->session->get('language', $this->config['general.default_language']));
 }
Esempio n. 2
0
<?php

return ['event_manager' => \DI\decorate(function ($eventManager, $container) {
    $eventManager->attach('ERROR_DISPATCH', [$container->get(\ClassicApp\EventListener\DispatcherExceptionListener::class), 'onError']);
    $eventManager->attach('*', [$container->get(\ClassicApp\EventListener\ExceptionListener::class), 'onError']);
    return $eventManager;
}), \ClassicApp\EventListener\ExceptionListener::class => \DI\object(\ClassicApp\EventListener\ExceptionListener::class)->constructor(\DI\get('template')), \ClassicApp\EventListener\DispatcherExceptionListener::class => \DI\object(\ClassicApp\EventListener\DispatcherExceptionListener::class)->constructor(\DI\get('template')), 'dispatcher' => \DI\factory(function (\DI\Container $c) {
    $dispatcher = new \ClassicApp\Dispatcher\SymfonyDispatcher($c->get('router'));
    return $dispatcher;
}), 'session' => \DI\factory(function (\DI\Container $c) {
    $session = new \Symfony\Component\HttpFoundation\Session\Session();
    $session->start();
    return $session;
}), 'translator' => \DI\factory(function () {
    $translator = new \Symfony\Component\Translation\Translator('en_US', new \Symfony\Component\Translation\MessageSelector());
    $translator->addLoader('php', new \Symfony\Component\Translation\Loader\PhpFileLoader());
    $translator->addResource('php', './app/Resources/translator/en_US.php', 'en_US');
    $translator->addResource('php', './app/Resources/translator/it_IT.php', 'it_IT');
    return $translator;
}), 'template' => \DI\factory(function (\DI\Container $c) {
    $twigBridgeViews = __DIR__ . '/../vendor/symfony/twig-bridge/Resources/views/Form';
    $loader = new Twig_Loader_Filesystem([$twigBridgeViews, './app/Resources/view']);
    $twig = new Twig_Environment($loader, $c->get('parameters')['twig']['loader_options']);
    $twig->addGlobal('show_exception_backtrace', $c->get('parameters')['twig']['show_exception_backtrace']);
    $twig->addGlobal('session', $c->get('session'));
    $formEngine = new \Symfony\Bridge\Twig\Form\TwigRendererEngine(['bootstrap_3_layout.html.twig']);
    $formEngine->setEnvironment($twig);
    $formExt = new \Symfony\Bridge\Twig\Extension\FormExtension(new \Symfony\Bridge\Twig\Form\TwigRenderer($formEngine));
    $twig->addExtension($formExt);
    $transExt = new \Symfony\Bridge\Twig\Extension\TranslationExtension($c->get('translator'));
    $twig->addExtension($transExt);
Esempio n. 3
0
 /**
  * @return \Symfony\Component\HttpFoundation\Session\Session
  */
 private function buildSession()
 {
     $session = new \Symfony\Component\HttpFoundation\Session\Session();
     $session->setName('PHPSIDIDP');
     $session->start();
     return $session;
 }
Esempio n. 4
0
 /**
  * {@inheritdoc}
  */
 public static function start()
 {
     return static::$instance->start();
 }