当前位置: 首页>>代码示例>>PHP>>正文


PHP ServiceKernel::create方法代码示例

本文整理汇总了PHP中Topxia\Service\Common\ServiceKernel::create方法的典型用法代码示例。如果您正苦于以下问题:PHP ServiceKernel::create方法的具体用法?PHP ServiceKernel::create怎么用?PHP ServiceKernel::create使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Topxia\Service\Common\ServiceKernel的用法示例。


在下文中一共展示了ServiceKernel::create方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: initServiceKernel

 private function initServiceKernel()
 {
     $serviceKernel = ServiceKernel::create('dev', false);
     $serviceKernel->setConnection($this->getContainer()->get('database_connection'));
     $currentUser = new CurrentUser();
     $currentUser->fromArray(array('id' => 1, 'nickname' => '测试管理员', 'currentIp' => '127.0.0.1', 'roles' => array("ROLE_SUPER_ADMIN")));
     $serviceKernel->setCurrentUser($currentUser);
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:8,代码来源:LiveNotifyCommand.php

示例2: initServiceKernel

 private function initServiceKernel()
 {
     global $kernel;
     $serviceKernel = ServiceKernel::create('dev', false);
     $serviceKernel->setParameterBag($kernel->getContainer()->getParameterBag());
     $serviceKernel->setConnection($kernel->getContainer()->get('database_connection'));
     return $serviceKernel;
 }
开发者ID:piaolankeke,项目名称:EduSoho,代码行数:8,代码来源:Version20150515152421.php

示例3: initServiceKernel

 private function initServiceKernel()
 {
     $serviceKernel = ServiceKernel::create('dev', false);
     $serviceKernel->setParameterBag($this->getContainer()->getParameterBag());
     $serviceKernel->setConnection($this->getContainer()->get('database_connection'));
     $user = $this->getUserService()->getUser(1);
     $serviceKernel->setCurrentUser($user);
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:8,代码来源:GenerateCourseCommand.php

示例4: initServiceKernel

 private function initServiceKernel()
 {
     $serviceKernel = ServiceKernel::create('dev', false);
     $serviceKernel->setParameterBag($this->getContainer()->getParameterBag());
     $serviceKernel->setConnection($this->getContainer()->get('database_connection'));
     $currentUser = new CurrentUser();
     $currentUser->fromArray(array('id' => 0, 'nickname' => '游客', 'currentIp' => '127.0.0.1', 'roles' => array()));
     $serviceKernel->setCurrentUser($currentUser);
 }
开发者ID:iCodeAnt,项目名称:EduSoho,代码行数:9,代码来源:HlsConvertCommand.php

示例5: initServiceKernel

 protected function initServiceKernel()
 {
     $serviceKernel = ServiceKernel::create('dev', true);
     $serviceKernel->setParameterBag($this->getContainer()->getParameterBag());
     $serviceKernel->registerModuleDirectory(dirname(__DIR__) . '/plugins');
     $serviceKernel->setConnection($this->getContainer()->get('database_connection'));
     $currentUser = new CurrentUser();
     $currentUser->fromArray(array('id' => 0, 'nickname' => '游客', 'currentIp' => '127.0.0.1', 'roles' => array()));
     $serviceKernel->setCurrentUser($currentUser);
 }
开发者ID:ccq18,项目名称:EduSoho,代码行数:10,代码来源:ApiTestCommand.php

示例6: setServiceKernel

 /**
  * 每个testXXX执行之前,都会执行此函数,净化数据库。
  * 
  * NOTE: 如果数据库已创建,那么执行清表操作,不重建。
  */
 private function setServiceKernel()
 {
     $kernel = new \AppKernel('test', false);
     $kernel->loadClassCache();
     $kernel->boot();
     Request::enableHttpMethodParameterOverride();
     $request = Request::createFromGlobals();
     $serviceKernel = ServiceKernel::create($kernel->getEnvironment(), $kernel->isDebug());
     $serviceKernel->setParameterBag($kernel->getContainer()->getParameterBag());
     $serviceKernel->setConnection($kernel->getContainer()->get('database_connection'));
     $currentUser = new CurrentUser();
     $currentUser->fromArray(array('id' => 1, 'nickname' => 'admin', 'email' => 'admin@admin.com', 'password' => 'admin', 'currentIp' => '127.0.0.1', 'roles' => array('ROLE_USER', 'ROLE_ADMIN', 'ROLE_SUPER_ADMIN', 'ROLE_TEACHER')));
     $serviceKernel->setCurrentUser($currentUser);
     $this->serviceKernel = $serviceKernel;
 }
开发者ID:styling,项目名称:LeesPharm,代码行数:20,代码来源:BaseTestCase.php

示例7: ParameterBag

use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\JsonResponse;
use Topxia\Service\Common\ServiceKernel;
use Topxia\Service\User\CurrentUser;
use Doctrine\DBAL\DriverManager;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\Debug\ErrorHandler;
use Symfony\Component\Debug\ExceptionHandler;
// use Symfony\Component\Debug\Debug;
// Debug::enable();
ErrorHandler::register();
ExceptionHandler::register();
$config = (include __DIR__ . '/config.php');
$config['host'] = 'http://' . $_SERVER['HTTP_HOST'];
$connection = DriverManager::getConnection(array('dbname' => $config['database_name'], 'user' => $config['database_user'], 'password' => $config['database_password'], 'host' => $config['database_host'], 'driver' => $config['database_driver'], 'charset' => 'utf8'));
$serviceKernel = ServiceKernel::create($config['environment'], true);
$serviceKernel->setParameterBag(new ParameterBag($config));
$serviceKernel->setConnection($connection);
// $serviceKernel->getConnection()->exec('SET NAMES UTF8');
include __DIR__ . '/src/functions.php';
$app = new Silex\Application();
$app->register(new Silex\Provider\ServiceControllerServiceProvider());
$app['debug'] = true;
$app->view(function (array $result, Request $request) use($app) {
    return new JsonResponse($result);
});
include __DIR__ . '/config/container.php';
$app->before(function (Request $request) use($app) {
    $whiteLists = (include __DIR__ . '/whiteList.php');
    $whiteLists = $request->getMethod() == 'GET' ? $whiteLists['get'] : $whiteLists['post'];
    $inWhiteList = 0;
开发者ID:bqx619,项目名称:edusoho_dev,代码行数:31,代码来源:index.php

示例8: install_step999

/**
 * 生产Key
 */
function install_step999()
{
    if (empty($_COOKIE['nokey'])) {
        if (empty($_SESSION)) {
            session_start();
        }
        $connection = _create_connection();
        $serviceKernel = ServiceKernel::create('prod', true);
        $serviceKernel->setParameterBag(new ParameterBag(array('kernel' => array('root_dir' => realpath(__DIR__ . '/../../app')))));
        $serviceKernel->setConnection($connection);
        $init = new SystemInit();
        $key = $init->initKey();
        echo json_encode($key);
    } else {
        echo json_encode(array('accessKey' => '__NOKEY__', 'secretKey' => '__NOKEY__'));
    }
}
开发者ID:jonesgithub,项目名称:EduSoho,代码行数:20,代码来源:start-install.php

示例9: AppKernel

}
use Symfony\Component\Debug\Debug;
use Topxia\Service\User\CurrentUser;
use Topxia\Service\Common\ServiceKernel;
use Symfony\Component\HttpFoundation\Request;
fix_gpc_magic();
$loader = (require_once __DIR__ . '/../app/bootstrap.php.cache');
Debug::enable();
require_once __DIR__ . '/../app/AppKernel.php';
$kernel = new AppKernel('dev', true);
$kernel->loadClassCache();
Request::enableHttpMethodParameterOverride();
$request = Request::createFromGlobals();
$kernel->boot();
// START: init service kernel
$serviceKernel = ServiceKernel::create($kernel->getEnvironment(), $kernel->isDebug());
$serviceKernel->setEnvVariable(array('host' => $request->getHttpHost(), 'schemeAndHost' => $request->getSchemeAndHttpHost(), 'basePath' => $request->getBasePath(), 'baseUrl' => $request->getSchemeAndHttpHost() . $request->getBasePath()));
$serviceKernel->setParameterBag($kernel->getContainer()->getParameterBag());
$serviceKernel->registerModuleDirectory(dirname(__DIR__) . '/plugins');
$serviceKernel->setConnection($kernel->getContainer()->get('database_connection'));
$serviceKernel->getConnection()->exec('SET NAMES UTF8');
$currentUser = new CurrentUser();
$currentUser->fromArray(array('id' => 0, 'nickname' => '游客', 'currentIp' => $request->getClientIp(), 'roles' => array()));
$serviceKernel->setCurrentUser($currentUser);
// END: init service kernel
// NOTICE: 防止请求捕捉失败而做异常处理
// 包括:数据库连接失败等
try {
    $response = $kernel->handle($request);
} catch (\RuntimeException $e) {
    echo "Error!  " . $e->getMessage();
开发者ID:robert-li-2015,项目名称:EduSoho,代码行数:31,代码来源:app_dev.php

示例10: ParameterBag

use Topxia\Api\ApiAuth;
use Symfony\Component\Debug\Exception\FlattenException;
use Symfony\Component\Debug\ErrorHandler;
use Symfony\Component\Debug\ExceptionHandler;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\ParameterBag;
use Symfony\Component\Debug\Debug;
if (API_ENV == 'prod') {
    ErrorHandler::register(0);
    ExceptionHandler::register(false);
}
$paramaters = (include __DIR__ . '/config/paramaters.php');
$paramaters['host'] = 'http://' . $_SERVER['HTTP_HOST'];
$connection = DriverManager::getConnection(array('wrapperClass' => 'Topxia\\Service\\Common\\Connection', 'dbname' => $paramaters['database_name'], 'user' => $paramaters['database_user'], 'password' => $paramaters['database_password'], 'host' => $paramaters['database_host'], 'driver' => $paramaters['database_driver'], 'charset' => 'utf8'));
$serviceKernel = ServiceKernel::create($paramaters['environment'], true);
$serviceKernel->setParameterBag(new ParameterBag($paramaters));
$serviceKernel->setConnection($connection);
include __DIR__ . '/src/functions.php';
$app = new Silex\Application();
include __DIR__ . '/config/' . API_ENV . '.php';
$app->register(new Silex\Provider\ServiceControllerServiceProvider());
$app->view(function (array $result, Request $request) use($app) {
    // 兼容气球云搜索的接口
    $documentType = $request->headers->get('X-Search-Document');
    if ($documentType) {
        $class = "Topxia\\Api\\SpecialResponse\\{$documentType}Response";
        if (!class_exists($class)) {
            throw new \RuntimeException("{$documentType}Response不存在!");
        }
        $obj = new $class();
开发者ID:fujianguo,项目名称:EduSoho,代码行数:31,代码来源:index.php

示例11: install_step3

function install_step3()
{
    check_installed();
    global $twig;
    $connection = _create_connection();
    $serviceKernel = ServiceKernel::create('prod', true);
    $serviceKernel->setConnection($connection);
    // $serviceKernel->setParameterBag($kernel->getContainer()->getParameterBag());
    $error = null;
    if (strtoupper($_SERVER['REQUEST_METHOD']) == 'POST') {
        $init = new SystemInit();
        $admin = $init->initAdmin($_POST['admin']);
        $init->initSiteSettings($_POST);
        $init->initRegisterSetting($admin);
        $init->initMailerSetting($_POST['sitename']);
        $init->initPaymentSetting();
        $init->initStorageSetting();
        $init->initTag();
        $init->initCategory();
        $init->initFile();
        $init->initPages();
        $init->initNavigations();
        $init->initBlocks();
        $init->initThemes();
        $init->initLockFile();
        $init->initRefundSetting();
        $init->initArticleSetting();
        $web = $_POST['web'];
        $userData = array();
        $userData['server_addr'] = $_SERVER['SERVER_ADDR'];
        $userData['server_name'] = $_SERVER['SERVER_NAME'];
        $userData['mobile'] = $web['mobile'];
        $userData['qq'] = $web['qq'];
        $userData['name'] = $web['name'];
        _postRequest("http://open.edusoho.com/track/install", $userData);
        header("Location: start-install.php?step=4");
        exit;
    }
    echo $twig->render('step-3.html.twig', array('step' => 3, 'error' => $error, 'request' => $_POST));
}
开发者ID:styling,项目名称:LeesPharm,代码行数:40,代码来源:start-install.php


注:本文中的Topxia\Service\Common\ServiceKernel::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。