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>

                          • 主站蜘蛛池模板: 浇钢砖,流钢砖_厂家价低-淄博恒森耐火材料有限公司 | 东莞螺杆空压机_永磁变频空压机_节能空压机_空压机工厂批发_深圳螺杆空压机_广州螺杆空压机_东莞空压机_空压机批发_东莞空压机工厂批发_东莞市文颖设备科技有限公司 | 上海冠顶工业设备有限公司-隧道炉,烘箱,UV固化机,涂装设备,高温炉,工业机器人生产厂家 | 彭世修脚_修脚加盟_彭世修脚加盟_彭世足疗加盟_足疗加盟连锁_彭世修脚技术培训_彭世足疗 | 移动厕所租赁|移动卫生间|上海移动厕所租赁-家瑞租赁 | 碳刷_刷握_集电环_恒压簧_电刷厂家-上海丹臻机电科技有限公司 | 实验室隔膜泵-无油防腐蚀隔膜泵-耐腐蚀隔膜真空泵-杭州景程仪器 电杆荷载挠度测试仪-电杆荷载位移-管桩测试仪-北京绿野创能机电设备有限公司 | 全自动包装秤_全自动上袋机_全自动套袋机_高位码垛机_全自动包装码垛系统生产线-三维汉界机器(山东)股份有限公司 | 集菌仪_智能集菌仪_全封闭集菌仪_无菌检查集菌仪厂家-那艾 | 密集架-密集柜厂家-智能档案密集架-自动选层柜订做-河北风顺金属制品有限公司 | 工程管道/塑料管材/pvc排水管/ppr给水管/pe双壁波纹管等品牌管材批发厂家-河南洁尔康建材 | 武汉画册印刷厂家-企业画册印刷-画册设计印刷制作-宣传画册印刷公司 - 武汉泽雅印刷厂 | 无锡装修装潢公司,口碑好的装饰装修公司-无锡索美装饰设计工程有限公司 | 碳纤维布-植筋胶-灌缝胶-固特嘉加固材料公司 | 耐高温风管_耐高温软管_食品级软管_吸尘管_钢丝软管_卫生级软管_塑料波纹管-东莞市鑫翔宇软管有限公司 | 高温高压釜(氢化反应釜)百科 | 汽车整车综合环境舱_军标砂尘_盐雾试验室试验箱-无锡苏南试验设备有限公司 | 英国雷迪地下管线探测仪-雷迪RD8100管线仪-多功能数字听漏仪-北京迪瑞进创科技有限公司 | 不锈钢闸阀_球阀_蝶阀_止回阀_调节阀_截止阀-可拉伐阀门(上海)有限公司 | 六维力传感器_三维力传感器_二维力传感器-南京神源生智能科技有限公司 | 企业微信营销_企业微信服务商_私域流量运营_艾客SCRM官网 | 冷镦机-多工位冷镦机-高速冷镦机厂家-温州金诺机械设备制造有限公司 | 包装机传感器-搅拌站传感器-山东称重传感器厂家-济南泰钦电气 | 密集架|电动密集架|移动密集架|黑龙江档案密集架-大量现货厂家销售 | 100_150_200_250_300_350_400公斤压力空气压缩机-舰艇航天配套厂家 | 欧美日韩国产一区二区三区不_久久久久国产精品无码不卡_亚洲欧洲美洲无码精品AV_精品一区美女视频_日韩黄色性爱一级视频_日本五十路人妻斩_国产99视频免费精品是看4_亚洲中文字幕无码一二三四区_国产小萍萍挤奶喷奶水_亚洲另类精品无码在线一区 | 执业药师报名时间,报考条件,考试时间-首页入口 | 家德利门业,家居安全门,别墅大门 - 安徽家德利门业有限公司 | 安平县鑫川金属丝网制品有限公司,声屏障,高速声屏障,百叶孔声屏障,大弧形声屏障,凹凸穿孔声屏障,铁路声屏障,顶部弧形声屏障,玻璃钢吸音板 | 食品质构分析仪-氧化诱导分析仪-瞬态法导热系数仪|热冰百科 | 有机肥设备生产制造厂家,BB掺混肥搅拌机、复合肥设备生产线,有机肥料全部加工设备多少钱,对辊挤压造粒机,有机肥造粒设备 -- 郑州程翔重工机械有限公司 | 温泉机设备|温泉小镇规划设计|碳酸泉设备 - 大连连邦温泉科技 | 土壤水分自动监测站-SM150便携式土壤水分仪-铭奥仪器 | 三防漆–水性三防漆–水性浸渍漆–贝塔三防漆厂家 | 六自由度平台_六自由度运动平台_三自由度摇摆台—南京全控科技 | 在线悬浮物浓度计-多参数水质在线检测仪-上海沃懋仪表科技有限公司 | 肉嫩度仪-凝胶测试仪-国产质构仪-气味分析仪-上海保圣实业发展有限公司|总部 | 酒店品牌设计-酒店vi设计-酒店标识设计【国际级】VI策划公司 | 小程序开发公司_APP开发多少钱_软件开发定制_微信小程序制作_客户销售管理软件-济南小溪畅流网络科技有限公司 | 厚壁钢管-厚壁无缝钢管-小口径厚壁钢管-大口径厚壁钢管 - 聊城宽达钢管有限公司 | 深圳律师咨询_深圳律师事务所_华荣【免费在线法律咨询】网 |