當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Application::getDI方法代碼示例

本文整理匯總了PHP中Phalcon\Mvc\Application::getDI方法的典型用法代碼示例。如果您正苦於以下問題:PHP Application::getDI方法的具體用法?PHP Application::getDI怎麽用?PHP Application::getDI使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Phalcon\Mvc\Application的用法示例。


在下文中一共展示了Application::getDI方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: boot

 /**
  * @param Application $app
  */
 public function boot(Application $app)
 {
     $options = $this->options;
     $app->getDI()->setShared('aws', function () use($options) {
         $aws = Aws::factory($options);
         $aws->getEventDispatcher()->addListener('service_builder.create_client', function (Event $event) {
             $clientConfig = $event['client']->getConfig();
             $commandParams = $clientConfig->get(Client::COMMAND_PARAMS) ?: array();
             $clientConfig->set(Client::COMMAND_PARAMS, array_merge_recursive($commandParams, array(UserAgentListener::OPTION => 'Phalcon/' . Application::VERSION)));
         });
         return $aws;
     });
 }
開發者ID:iwai,項目名稱:aws-sdk-php-phalcon,代碼行數:16,代碼來源:AwsServiceProvider.php

示例2: customServices

 /**
  * 自定義服務注入
  *
  */
 protected function customServices()
 {
     $di = $this->application->getDI();
     // 自定義服務
     $this->application->setDI($di);
 }
開發者ID:smallmenu,項目名稱:learning-phalcon,代碼行數:10,代碼來源:Bootstrap.php

示例3: beforeStartModule

 public function beforeStartModule(Event $event, PhalconApp $app, $moduleName)
 {
     $di = $app->getDI();
     $config = $di->get('config');
     $this->setViewService($di, $config, $moduleName)->setUrlService($di, $config, $moduleName);
 }
開發者ID:tmquang6805,項目名稱:phalex,代碼行數:6,代碼來源:Application.php

示例4: applicationSetup

 /**
  * Setup the phalcon application.
  *
  * @param null $uri
  * @return string
  */
 protected function applicationSetup($uri = null)
 {
     $app = new Application($this->di);
     $app->useImplicitView('null' === $this->config['view']['default'] ? false : true);
     // set event manager for application
     $eventManager = $app->getDI()->getShared('eventsManager');
     $this->setEventsManager($eventManager);
     $this->registerEvents();
     /*
      * TODO This is bug on phalcon 2.0.4
      */
     $app->setEventsManager($this->getEventsManager());
     return $app->handle($uri)->getContent();
 }
開發者ID:broklyngagah,項目名稱:orbit,代碼行數:20,代碼來源:Bootstrap.php

示例5: Application

$debug->listen();
/**
 * Include services
 */
require __DIR__ . '/../config/services.php';
/**
 * Include loaders
 */
require __DIR__ . '/../config/loader.php';
/**
 * Handle the request
 */
$application = new Application();
$eventsManager = new Phalcon\Events\Manager();
$application->setEventsManager($eventsManager);
$eventsManager->attach('application:viewRender', function ($event, $application) {
    $dispatcher = $application->getDI()->getDispatcher();
    $controllerName = strtolower($dispatcher->getControllerName());
    if (substr($controllerName, 0, 1) == '\\') {
        $dispatcher->setControllerName(substr($controllerName, 1));
    }
});
/**
 * Assign the DI
 */
$application->setDI($di);
/**
 * Include modules
 */
require __DIR__ . '/../config/modules.php';
echo $application->handle()->getContent();
開發者ID:riquedesimone,項目名稱:biko,代碼行數:31,代碼來源:index.php


注:本文中的Phalcon\Mvc\Application::getDI方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。