public __construct ( Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher, Symfony\Component\HttpKernel\Controller\ControllerResolverInterface $resolver, Symfony\Component\HttpFoundation\RequestStack $requestStack = null, Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface $argumentResolver = null ) | ||
$dispatcher | Symfony\Component\EventDispatcher\EventDispatcherInterface | |
$resolver | Symfony\Component\HttpKernel\Controller\ControllerResolverInterface | |
$requestStack | Symfony\Component\HttpFoundation\RequestStack | |
$argumentResolver | Symfony\Component\HttpKernel\Controller\ArgumentResolverInterface |
public function __construct($routes, Request $request, EventDispatcher $dispatcher, ControllerResolver $resolver) { $this->deflRes = new NodeResponse(); $this->context = new RequestContext($request->getBaseUrl(), $request->getMethod(), $request->getHost(), $request->getScheme(), $request->getPort(), $request->getPort()); $this->matcher = new UrlMatcher($routes, $this->context); parent::__construct($dispatcher, $resolver); }
public function __construct($environment = 'prod', $debug = false) { // dev, prod or schell define('Ki_ENVIRONMENT', $environment); define('Ki_DEBUG', is_bool($debug) ? $debug : false); if (Ki_DEBUG) { Debug::enable(); } else { ini_set('display_errors', 0); } if (!in_array(Ki_ENVIRONMENT, array('dev', 'prod', 'shell'))) { throw new \Exception("El entorno '" . Ki_ENVIRONMENT . "' no está permitido en el sistema."); } // Agrega la instancia del kernel al contenedor de servicios. // Util para ser usada cuando de desde realizar una sub peticion dende en controlador. Service::instance('kernel', $this); // Registra la bolsa temporal en la session $session = Service::get('session'); $session->registerBag(Service::get('temporary_bag')); $session->start(); // Carga la configuracion del proyecto Service::get('config')->loadConfigGlobal(); // Carga la configuracion de los bundles $this->registerBundles(); // Carga la clase translator Service::get('translator')->loader(Service::get('session')->getLocale()); $this->registerProviders(); $this->registerListeners(); if (Ki_ENVIRONMENT == 'shell') { Service::get('shell')->console(); return; } parent::__construct(Service::get('event'), Service::get('kernel.resolver')); }
public function __construct($body, $status, $headers, \Closure $customizer = null) { $this->body = $body; $this->status = $status; $this->headers = $headers; $this->customizer = $customizer; parent::__construct(new EventDispatcher(), $this); }
/** * Constructor. * * @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance * @param ContainerInterface $container A ContainerInterface instance * @param ControllerResolverInterface $controllerResolver A ControllerResolverInterface instance */ public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver) { parent::__construct($dispatcher, $controllerResolver); $this->container = $container; // the request scope might have been created before (see FrameworkBundle) if (!$container->hasScope('request')) { $container->addScope(new Scope('request')); } }
public function __construct($responses) { foreach ($responses as $response) { $this->bodies[] = $response['body']; $this->statuses[] = $response['status']; $this->headers[] = $response['headers']; } parent::__construct(new EventDispatcher(), $this); }
/** * Constructor * * @param ServiceContainer container * @param ApplicationInterface $app * @param ControllerResolverInterface $resolver */ public function __construct(ServiceContainer $container, ApplicationInterface $app, ControllerResolverInterface $resolver) { $this->container = $container; $this->resolver = $resolver; $this->container->setApp($app); $this->loadConfig()->loadRouting(); $this->container->setConfig($app->getConfig()); $this->dispatchEvent(KernelEvents::APP_LOADED, new KernelEvent($container)); $this->container['kernel'] = $this; parent::__construct($this->container['core']['dispatcher'], $resolver); }
/** * Constructor. * * @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance * @param ContainerInterface $container A ContainerInterface instance * @param ControllerResolverInterface $controllerResolver A ControllerResolverInterface instance * @param RequestStack $requestStack A stack for master/sub requests * @param bool $triggerDeprecation Whether or not to trigger the deprecation warning for the ContainerAwareHttpKernel */ public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver, RequestStack $requestStack = null, $triggerDeprecation = true) { parent::__construct($dispatcher, $controllerResolver, $requestStack); if ($triggerDeprecation) { @trigger_error('The ' . __CLASS__ . ' class is deprecated since version 2.7 and will be removed in 3.0. Use the Symfony\\Component\\HttpKernel\\HttpKernel class instead.', E_USER_DEPRECATED); } $this->container = $container; // the request scope might have been created before (see FrameworkBundle) if (!$container->hasScope('request')) { $container->addScope(new Scope('request')); } }
public function __construct() { $this->shared = array(); $this->providers = array(); $resolver = new ControllerResolver($this); $env = $this->getEnvironment(); $this->dispatcher = new EventDispatcher(); $this->dispatcher->addSubscriber(new EventListener\RedirectListener()); $this->dispatcher->addSubscriber(new HttpKernel\EventListener\ResponseListener('UTF-8')); $this->dispatcher->addSubscriber(new ExceptionHandler($env == 'dev')); parent::__construct($this->dispatcher, $resolver); }
public function __construct() { $this->container = new Container(); $this->initConfigs(); $this->container->init($this); $this->initRoutes(); $this->initModules(); $this->initEnvironment(); $this->initTimezone(); $this->initUnicode(); $this->container['kernel'] = $this; parent::__construct($this->container['dispatcher'], $this->container['resolver']); }
public function __construct($map) { $this->routes = new RouteCollection(); foreach ($map as $pattern => $to) { if (false !== strpos($pattern, ' ')) { list($method, $pattern) = explode(' ', $pattern, 2); $requirements = array('_method' => $method); } else { $requirements = array(); } $route = new Route($pattern, array('_controller' => $to), $requirements); $this->routes->add(str_replace(array('/', ':'), '_', $pattern), $route); } $dispatcher = new EventDispatcher(); $dispatcher->connect('core.request', array($this, 'parseRequest')); $resolver = new ControllerResolver(); parent::__construct($dispatcher, $resolver); }
public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver) { parent::__construct($dispatcher, $controllerResolver); $this->container = $container; }
public function __construct() { parent::__construct(new EventDispatcher(), $this); }
public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver, RequestStack $requestStack = null) { parent::__construct($dispatcher, $controllerResolver, $requestStack); $this->container = $container; if (!$container->hasScope('request')) { $container->addScope(new Scope('request')); } }
public function __construct() { $this->container = Container::getInstance(); parent::__construct($this->container->get('dispatcher'), $this->container->get('resolver')); }
/** * Constructor. * * @param EventDispatcherInterface $dispatcher An EventDispatcherInterface instance * @param ContainerInterface $container A ContainerInterface instance * @param ControllerResolverInterface $controllerResolver A ControllerResolverInterface instance */ public function __construct(EventDispatcherInterface $dispatcher, ContainerInterface $container, ControllerResolverInterface $controllerResolver) { parent::__construct($dispatcher, $controllerResolver); $this->container = $container; $container->addScope(new Scope('request')); }