久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

  • <legend id='MhGZo'><style id='MhGZo'><dir id='MhGZo'><q id='MhGZo'></q></dir></style></legend>

      <tfoot id='MhGZo'></tfoot>

      <small id='MhGZo'></small><noframes id='MhGZo'>

          <bdo id='MhGZo'></bdo><ul id='MhGZo'></ul>
      1. <i id='MhGZo'><tr id='MhGZo'><dt id='MhGZo'><q id='MhGZo'><span id='MhGZo'><b id='MhGZo'><form id='MhGZo'><ins id='MhGZo'></ins><ul id='MhGZo'></ul><sub id='MhGZo'></sub></form><legend id='MhGZo'></legend><bdo id='MhGZo'><pre id='MhGZo'><center id='MhGZo'></center></pre></bdo></b><th id='MhGZo'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='MhGZo'><tfoot id='MhGZo'></tfoot><dl id='MhGZo'><fieldset id='MhGZo'></fieldset></dl></div>
      2. 已棄用:在功能系統中檢索服務定位器 - ZF2

        Deprecated: Retrieve service locator in functional system - ZF2(已棄用:在功能系統中檢索服務定位器 - ZF2)
          • <small id='wC9Rr'></small><noframes id='wC9Rr'>

              <bdo id='wC9Rr'></bdo><ul id='wC9Rr'></ul>

                  <legend id='wC9Rr'><style id='wC9Rr'><dir id='wC9Rr'><q id='wC9Rr'></q></dir></style></legend>

                  <tfoot id='wC9Rr'></tfoot>

                  <i id='wC9Rr'><tr id='wC9Rr'><dt id='wC9Rr'><q id='wC9Rr'><span id='wC9Rr'><b id='wC9Rr'><form id='wC9Rr'><ins id='wC9Rr'></ins><ul id='wC9Rr'></ul><sub id='wC9Rr'></sub></form><legend id='wC9Rr'></legend><bdo id='wC9Rr'><pre id='wC9Rr'><center id='wC9Rr'></center></pre></bdo></b><th id='wC9Rr'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='wC9Rr'><tfoot id='wC9Rr'></tfoot><dl id='wC9Rr'><fieldset id='wC9Rr'></fieldset></dl></div>
                    <tbody id='wC9Rr'></tbody>
                • 本文介紹了已棄用:在功能系統中檢索服務定位器 - ZF2的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我正在開發一個 ZF2 系統,它運行良好,但是在我在其他計算機上克隆存儲庫后,出現了這個已棄用的錯誤:

                  I'm developing a ZF2 system and it was working very well, but after I clone the repository in other computer this deprecated error has appeared:

                  您正在從 ModuleControllerController 類中檢索服務定位器.請注意,ServiceLocatorAwareInterface 已棄用,將在 3.0 版中與 ServiceLocatorAwareInitializer 一起刪除.您需要更新您的類以在創建時接受所有依賴項,通過構造函數參數或設置器,并使用工廠來執行注入.在第 258 行的/home/path/project/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php 中

                  You are retrieving the service locator from within the class ModuleControllerController. Please be aware that ServiceLocatorAwareInterface is deprecated and will be removed in version 3.0, along with the ServiceLocatorAwareInitializer. You will need to update your class to accept all dependencies at creation, either via constructor arguments or setters, and use a factory to perform the injections. in /home/path/project/vendor/zendframework/zend-mvc/src/Controller/AbstractController.php on line 258

                  composer.json:

                  The composer.json:

                  "require": {
                      "php": ">=5.5",
                      "ext-curl": "*",
                      "ext-json": "*",
                      "ext-mbstring": "*",
                      "zendframework/zendframework": "~2.5",
                      "doctrine/doctrine-orm-module": "0.*",
                      "hounddog/doctrine-data-fixture-module": "0.0.*",
                      "imagine/Imagine": "~0.5.0"
                  

                  在我的控制器中檢索服務時出現錯誤(擴展 ZendMvcControllerAbstractActionController):

                  The error appears when I retrieve the service in my controllers (extending ZendMvcControllerAbstractActionController):

                  $this->getServiceLocator()->get("ModuleServiceService");
                  

                  在 Zend 內核中 ZendMvcControllerAbstractController 是這樣的:

                  In the Zend core at ZendMvcControllerAbstractController is like this:

                  public function getServiceLocator()
                  {
                      trigger_error(sprintf(
                          'You are retrieving the service locator from within the class %s. Please be aware that '
                          . 'ServiceLocatorAwareInterface is deprecated and will be removed in version 3.0, along '
                          . 'with the ServiceLocatorAwareInitializer. You will need to update your class to accept '
                          . 'all dependencies at creation, either via constructor arguments or setters, and use '
                          . 'a factory to perform the injections.',
                          get_class($this)
                      ), E_USER_DEPRECATED);
                  
                      return $this->serviceLocator;
                  }
                  

                  以前只有這個:

                  public function getServiceLocator()
                  {
                      return $this->serviceLocator;
                  }
                  

                  我什么都試過了,有人知道我該怎么做嗎?

                  I've tried everything, someone know what I've to do?

                  推薦答案

                  您無需執行任何操作,還沒有.當您升級到 ZF3 時,您將不得不更改控制器類接收其依賴項的方式.

                  You don't have to do anything, yet. When you upgrade to ZF3, then you will have to change how your controller class receives its dependencies.

                  ZF2 支持兩種依賴注入模式:通過服務定位器和通過構造函數.ZF3 刪除了按服務位置"并需要按構造函數".所有這一切都有效地改變了依賴關系的解決方式,將解決方案從及時"轉移到構建時".

                  ZF2 supports two dependency injection patterns: by service locator and by constructor. ZF3 removes "by service location" and requires "by constructor". All this does, effectively, is change how dependencies resolve, moving the resolution from "just in time" to "at construction".

                  您不能從任何地方獲得服務,而是在施工處接收它們.按照以下幾行更新您的代碼:

                  Instead of being able to get a service from anywhere, you instead receive them at construction. Update your code along the following lines:

                  namespace ModuleController;
                  
                  class Controller {
                      public function __construct(ModuleServiceService $service) {
                          $this->service = $service;
                      }
                  }
                  

                  在類的方法中需要$this->service 的地方使用它.

                  Use $this->service where you need it in the class's methods.

                  然后使用控制器工廠來創建您的控制器,如下所示:

                  Then use a controller factory to create your controller, like so:

                  function ($controllers) { 
                      $services = $controllers->getServiceLocator();
                      return new ModuleControllerController($services->get('ModuleServiceService')); 
                  } 
                  

                  在問題 5168 和 這篇博文 討論了為什么使用服務定位器的服務注入是一種反模式.

                  The change is discussed in Issue 5168, and this blog post discusses why service injection with a service locator is an anti-pattern.

                  這篇關于已棄用:在功能系統中檢索服務定位器 - ZF2的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

                  【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

                  相關文檔推薦

                  Deadlock exception code for PHP, MySQL PDOException?(PHP、MySQL PDOException 的死鎖異常代碼?)
                  PHP PDO MySQL scrollable cursor doesn#39;t work(PHP PDO MySQL 可滾動游標不起作用)
                  PHP PDO ODBC connection(PHP PDO ODBC 連接)
                  Using PDO::FETCH_CLASS with Magic Methods(使用 PDO::FETCH_CLASS 和魔術方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅動程序)
                    1. <legend id='3kko5'><style id='3kko5'><dir id='3kko5'><q id='3kko5'></q></dir></style></legend>

                        <small id='3kko5'></small><noframes id='3kko5'>

                          <tbody id='3kko5'></tbody>
                          <bdo id='3kko5'></bdo><ul id='3kko5'></ul>

                        • <i id='3kko5'><tr id='3kko5'><dt id='3kko5'><q id='3kko5'><span id='3kko5'><b id='3kko5'><form id='3kko5'><ins id='3kko5'></ins><ul id='3kko5'></ul><sub id='3kko5'></sub></form><legend id='3kko5'></legend><bdo id='3kko5'><pre id='3kko5'><center id='3kko5'></center></pre></bdo></b><th id='3kko5'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='3kko5'><tfoot id='3kko5'></tfoot><dl id='3kko5'><fieldset id='3kko5'></fieldset></dl></div>

                          <tfoot id='3kko5'></tfoot>

                          • 主站蜘蛛池模板: 99热精品国产 | 男人视频网站 | 91精品国产一区二区在线观看 | 美国一级片在线观看 | 成人免费观看男女羞羞视频 | 亚洲精品福利视频 | 欧美成视频在线观看 | 日日操视频 | 成人在线免费 | 亚洲国产精品一区二区第一页 | 国产精品中文在线 | 国产乱精品一区二区三区 | 中文字幕亚洲视频 | 国产精品一区在线观看 | 欧美黄色性生活视频 | 成人av在线网站 | 亚洲网址在线观看 | 国产精品久久久久久吹潮 | 国产1页 | 超碰操 | 成人午夜免费视频 | 精区3d动漫一品二品精区 | 干一干操一操 | 国产美女精品 | 日韩欧美在线观看 | 国产精品视频久久 | 99reav| 久久国产麻豆 | 秋霞电影一区二区三区 | 国产精品日韩欧美一区二区三区 | 一级特黄色毛片 | 男女免费观看在线爽爽爽视频 | 国产一极毛片 | 国产一在线观看 | 国产精品视频久久 | 亚洲精品一区中文字幕乱码 | 天天色综 | 国产精品影视 | 黄色成人av | 日本视频一区二区三区 | 在线日韩视频 |