pbootcms网站模板|日韩1区2区|织梦模板||网站源码|日韩1区2区|jquery建站特效-html5模板网

  • <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="sg4akms" 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="8yu8igk" 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="gqu60a8" id='3kko5'><tfoot id='3kko5'></tfoot><dl id='3kko5'><fieldset id='3kko5'></fieldset></dl></div>

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

                          • 主站蜘蛛池模板: 冷轧机|两肋冷轧机|扁钢冷轧机|倒立式拉丝机|钢筋拔丝机|收线机-巩义市华瑞重工机械制造有限公司 | 广州展台特装搭建商|特装展位设计搭建|展会特装搭建|特装展台制作设计|展览特装公司 | 深圳货架厂家_金丽声精品货架_广东金丽声展示设备有限公司官网 | 一体式钢筋扫描仪-楼板测厚仪-裂缝检测仪-泰仕特(北京) | 济宁工业提升门|济宁电动防火门|济宁快速堆积门-济宁市统一电动门有限公司 | 海水晶,海水素,海水晶价格-潍坊滨海经济开发区强隆海水晶厂 | 高低温万能试验机_拉力试验机_拉伸试验机-馥勒仪器科技(上海)有限公司 | 北京模型公司-军事模型-工业模型制作-北京百艺模型沙盘公司 | 扒渣机,铁水扒渣机,钢水扒渣机,铁水捞渣机,钢水捞渣机-烟台盛利达工程技术有限公司 | 泥浆在线密度计厂家-防爆数字压力表-膜盒-远传压力表厂家-江苏大亚自控设备有限公司 | 合肥宠物店装修_合肥宠物美容院装修_合肥宠物医院设计装修公司-安徽盛世和居装饰 | 压片机_高速_单冲_双层_花篮式_多功能旋转压片机-上海天九压片机厂家 | SMN-1/SMN-A ABB抽屉开关柜触头夹紧力检测仪-SMN-B/SMN-C-上海徐吉 | 直读光谱仪,光谱分析仪,手持式光谱仪,碳硫分析仪,创想仪器官网 | 报警器_家用防盗报警器_烟雾报警器_燃气报警器_防盗报警系统厂家-深圳市刻锐智能科技有限公司 | 断桥铝破碎机_发动机破碎机_杂铝破碎机厂家价格-皓星机械 | 不锈钢酒柜|恒温酒柜|酒柜定制|酒窖定制-上海啸瑞实业有限公司 | 工业洗衣机_工业洗涤设备_上海力净工业洗衣机厂家-洗涤设备首页 bkzzy在职研究生网 - 在职研究生招生信息咨询平台 | 右手官网|右手工业设计|外观设计公司|工业设计公司|产品创新设计|医疗产品结构设计|EMC产品结构设计 | 万濠投影仪_瑞士TRIMOS高度仪_尼康投影仪V12BDC|量子仪器 | 工业铝型材生产厂家_铝合金型材配件批发精加工定制厂商 - 上海岐易铝业 | 深圳标识制作公司-标识标牌厂家-深圳广告标识制作-玟璟广告-深圳市玟璟广告有限公司 | 清水混凝土修复_混凝土色差修复剂_混凝土色差调整剂_清水混凝土色差修复_河南天工 | 上海深蓝_缠绕机_缠膜机-上海深蓝机械装备有限公司 | 防潮防水通风密闭门源头实力厂家 - 北京酷思帝克门窗 | 开云(中国)Kaiyun·官方网站 - 登录入口| 铸铁平台,大理石平台专业生产厂家_河北-北重机械 | 华夏医界网_民营医疗产业信息平台_民营医院营销管理培训 | 谈股票-今日股票行情走势分析-牛股推荐排行榜 | 【灵硕展览集团】展台展会设计_展览会展台搭建_展览展示设计一站式服务公司 | _网名词典_网名大全_qq网名_情侣网名_个性网名 | 凝胶成像系统(wb成像系统)百科-上海嘉鹏 | 无锡不干胶标签,卷筒标签,无锡瑞彩包装材料有限公司 | 阳光1号桔柚_无核沃柑_柑橘新品种枝条苗木批发 - 苧金网 | 航空障碍灯_高中低光强航空障碍灯_民航许可认证航空警示灯厂家-东莞市天翔航天科技有限公司 | 铝箔袋,铝箔袋厂家,东莞铝箔袋,防静电铝箔袋,防静电屏蔽袋,防静电真空袋,真空袋-东莞铭晋让您的产品与众不同 | 济南ISO9000认证咨询代理公司,ISO9001认证,CMA实验室认证,ISO/TS16949认证,服务体系认证,资产管理体系认证,SC食品生产许可证- 济南创远企业管理咨询有限公司 郑州电线电缆厂家-防火|低压|低烟无卤电缆-河南明星电缆 | 艾乐贝拉细胞研究中心 | 国家组织工程种子细胞库华南分库 | 仓储笼_仓储货架_南京货架_仓储货架厂家_南京货架价格低-南京一品仓储设备制造公司 | 深圳市源和塑胶电子有限公司-首页| 济南画室培训-美术高考培训-山东艺霖艺术培训画室 |