Beispiel #1
0
 public static function bootstrapKernel(AppKernel $kernel)
 {
     $app_container = $kernel->getAppServiceContainer();
     $configuration = $kernel->getConfiguration();
     $routes_config = empty($configuration->routing) ? array() : $configuration->routing;
     /** @var \Symfony\Component\Routing\RouteCollection $routes */
     $routes = $app_container->tag('route_collection');
     foreach ($routes_config as $route_name => $route_config) {
         $routes->add($route_name, new Route($route_config['path'], $route_config['defaults'] ? $route_config['defaults']->toArray() : [], $route_config['requirements'] ? $route_config['requirements']->toArray() : [], $route_config['options'] ? $route_config['options']->toArray() : [], $route_config['host'], $route_config['schemes'] ? $route_config['schemes']->toArray() : [], $route_config['methods'] ? $route_config['methods']->toArray() : [], $route_config['condition']));
     }
 }
Beispiel #2
0
 public function bootstrapKernel(AppKernel $kernel)
 {
     $kernel->bootstrap();
     $kernel->getConfiguration()->setReadOnly();
 }
Beispiel #3
0
<?php

/**
 * Created by PhpStorm.
 * User: tachigo
 * Date: 16-8-23
 * Time: 下午3:12
 */
use Symfony\Component\Yaml\Yaml;
use Zero\Component\Kernel\AppKernel;
require '../../config/config.http.php';
define('CACHE_ROOT', APP_ROOT . '/cache');
// 配置文件地址
$kernel = new AppKernel(Yaml::parse(file_get_contents(APP_ROOT . '/config/config.' . ENTRY . '.yml')));
$configuration = $kernel->getConfiguration();
// yml格式的配置文件解析器
$yml_configuration_parser = function ($path) {
    if ($path) {
        return Yaml::parse(file_get_contents($path));
    }
    return array();
};
$modules = array(new \Zero\Module\Zero\Http\ZeroHttpModule($yml_configuration_parser), new \Zero\Module\Zero\Twig\ZeroTwigModule($yml_configuration_parser), new \Zero\Module\Metronic\AssetsModule\MetronicAssetsModule($yml_configuration_parser), new \Zero\Module\Metronic\AdminModule\MetronicAdminModule($yml_configuration_parser), new \Tachigo\Database\TachigoDatabaseModule($yml_configuration_parser), new \Tachigo\Admin\TachigoAdminModule($yml_configuration_parser), new \Tachigo\User\TachigoUserAdmin($yml_configuration_parser), new \Tachigo\User\TachigoUserAware($yml_configuration_parser), new \Tachigo\WWW\TachigoWWWAdmin($yml_configuration_parser), new \Tachigo\Forum\TachigoForumAdmin($yml_configuration_parser), new \Tachigo\Game\TachigoGameAdmin($yml_configuration_parser), new \Tachigo\TinyMCE\TachigoTinyMCEModule($yml_configuration_parser));
foreach ($modules as $module) {
    $configuration->merge($module());
    $kernel->registerModule($module);
}
$kernel->initAppServiceContainer('TachigoAdminServiceContainer');
$app_container = $kernel->getAppServiceContainer();
$app_container->bootstrapKernel($kernel);
$app_container->tag('debugger');
Beispiel #4
0
<?php

/**
 * 入口文件
 */
use Symfony\Component\Yaml\Yaml;
use Zero\Component\Kernel\AppKernel;
require '../config/config.http.php';
define('CACHE_ROOT', APP_ROOT . '/cache');
// 配置文件地址
$kernel = new AppKernel(Yaml::parse(file_get_contents(APP_ROOT . '/app/config/config.' . ENTRY . '_' . ENV . '.yml')));
$configuration = $kernel->getConfiguration();
// yml格式的配置文件解析器
$yml_configuration_parser = function ($path) {
    if ($path) {
        return Yaml::parse(file_get_contents($path));
    }
    return array();
};
$modules = array(new \Zero\Module\Zero\Twig\ZeroTwigModule($yml_configuration_parser), new \TknyMed\DatabaseModule\TknyMedDatabaseModule($yml_configuration_parser), new \TknyMed\ForumModule\TknyMedForumMobile($yml_configuration_parser));
foreach ($modules as $module) {
    $configuration->merge($module());
    $kernel->registerModule($module);
}
$kernel->initAppServiceContainer('TknyMedBBSServiceContainer');
$app_container = $kernel->getAppServiceContainer();
$app_container->tag('debugger');
// 这个地方开始自行调用接收请求的逻辑
\Zero\Component\Kernel\HttpProcessor::process($kernel, $app_container);
Beispiel #5
0
<?php

/**
 * 入口文件
 */
use Symfony\Component\Yaml\Yaml;
use Zero\Component\Kernel\AppKernel;
require 'config.php';
$kernel = new AppKernel(Yaml::parse(APP_ROOT . '/app/config.' . ENV . '.yml'));
$configuration = $kernel->getConfiguration();
// yaml格式的配置文件解析器
$yml_configuration_parser = function ($path) {
    return Yaml::parse(file_get_contents($path));
};
$modules = array(new Zero\Module\Demo\Demo9173\Demo9173Module($yml_configuration_parser));
foreach ($modules as $module) {
    $configuration->merge($module());
    $kernel->registerModule($module);
}
$kernel->initAppServiceContainer();
$app_container = $kernel->getAppServiceContainer();
$app_container->tag('debugger');
// 这个地方开始自行调用接收请求的逻辑