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


PHP Service::set方法代码示例

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


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

示例1: __construct

 /**
  * 
  */
 public function __construct()
 {
     $config = new Config();
     $config->loadConfig('config.yml');
     Service::set('config', $config);
     $request = new Request();
     Service::set('request', $request);
     $session = new Session();
     Service::set('session', $session);
     $routes = (include '../config/routes.php');
     $router = new Router($routes);
     Service::set('router', $router);
     Service::set('pdo', new \PDO($config->getVal('mysql/type') . ':host=' . $config->getVal('mysql/host') . ';dbname=' . $config->getVal('mysql/db'), $config->getVal('mysql/username'), $config->getVal('mysql/pass'), array(\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION, \PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8')));
     $log = new Log(URL . '/logs/log.txt');
     Service::set('log', $log);
     Service::set('user', new User());
 }
开发者ID:JavaTrain,项目名称:train,代码行数:20,代码来源:Application.php

示例2: createServices

 /**
  * Create services
  *
  * @throws Exception\DatabaseException
  */
 private function createServices()
 {
     Service::set('request', new Request());
     Service::set('db', DBConnection::getInstance(Service::get('config')->get('pdo')));
     Database::setConnection(Service::get('db'));
     Service::set('session', new Session());
     Service::set('security', new Security(Service::get('config')->get('security.login_route'), Service::get('config')->get('security.user_class')));
     Service::set('router', new Router(Service::get('config')->get('routes')));
     Service::set('render', new Render(Service::get('config')->get('main_layout')));
 }
开发者ID:Insidexa,项目名称:Framework,代码行数:15,代码来源:Application.php

示例3: addService

 /**
  * @brief Function addService
  *      adiciona um novo serviço no banco de dados.
  * @param id_adm do usuario logado
  * @return mensagem indicador de erro ou sucesso
  */
 public function addService($id_adm)
 {
     $moreService = new Service();
     return $moreService->set($id_adm);
 }
开发者ID:cassiod,项目名称:SisAdm,代码行数:11,代码来源:Services.class.php

示例4: function

    return new Kodazzi\Console\Commands\DatabaseCommand();
});
Service::factory('command.model', function () {
    return new Kodazzi\Console\Commands\ModelCommand();
});
Service::factory('command.form', function () {
    return new Kodazzi\Console\Commands\FormsCommand();
});
Service::factory('command.bundle', function () {
    return new Kodazzi\Console\Commands\BundleCommand();
});
Service::factory('command.routes', function () {
    return new Kodazzi\Console\Commands\RoutesCommand();
});
Service::set('shell', function () {
    return new Kodazzi\Console\Shell();
});
Service::factory('new.request', function () {
    return new Symfony\Component\HttpFoundation\Request();
});
// Captura la peticion
Service::instance('kernel.request', Symfony\Component\HttpFoundation\Request::createFromGlobals());
// Agrega al contenedor la instancia de Request y loader.
Service::instance('kernel.loader', $loader);
// Suscribe los escuchas
$dispatcher = Service::get('event');
$dispatcher->addSubscriber(Service::get('listener.router'));
$dispatcher->addSubscriber(Service::get('listener.firewall'));
$dispatcher->addSubscriber(Service::get('listener.controller'));
$dispatcher->addSubscriber(Service::get('listener.locale'));
$dispatcher->addSubscriber(Service::get('listener.response'));
开发者ID:kodazzi,项目名称:framework,代码行数:31,代码来源:container.php


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