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

    • <bdo id='kw14d'></bdo><ul id='kw14d'></ul>

    1. <small id='kw14d'></small><noframes id='kw14d'>

      <tfoot id='kw14d'></tfoot>

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

        <i id='kw14d'><tr id='kw14d'><dt id='kw14d'><q id='kw14d'><span id='kw14d'><b id='kw14d'><form id='kw14d'><ins id='kw14d'></ins><ul id='kw14d'></ul><sub id='kw14d'></sub></form><legend id='kw14d'></legend><bdo id='kw14d'><pre id='kw14d'><center id='kw14d'></center></pre></bdo></b><th id='kw14d'></th></span></q></dt></tr></i><div class="p7v5lxt" id='kw14d'><tfoot id='kw14d'></tfoot><dl id='kw14d'><fieldset id='kw14d'></fieldset></dl></div>
      1. ZF2:ZfcUser 模塊的自定義用戶映射器

        ZF2: Custom user mapper for ZfcUser module(ZF2:ZfcUser 模塊的自定義用戶映射器)

        1. <tfoot id='8JENN'></tfoot>
        2. <i id='8JENN'><tr id='8JENN'><dt id='8JENN'><q id='8JENN'><span id='8JENN'><b id='8JENN'><form id='8JENN'><ins id='8JENN'></ins><ul id='8JENN'></ul><sub id='8JENN'></sub></form><legend id='8JENN'></legend><bdo id='8JENN'><pre id='8JENN'><center id='8JENN'></center></pre></bdo></b><th id='8JENN'></th></span></q></dt></tr></i><div class="5r7v7n5" id='8JENN'><tfoot id='8JENN'></tfoot><dl id='8JENN'><fieldset id='8JENN'></fieldset></dl></div>

          <small id='8JENN'></small><noframes id='8JENN'>

          • <bdo id='8JENN'></bdo><ul id='8JENN'></ul>

                <legend id='8JENN'><style id='8JENN'><dir id='8JENN'><q id='8JENN'></q></dir></style></legend>
                    <tbody id='8JENN'></tbody>

                1. 本文介紹了ZF2:ZfcUser 模塊的自定義用戶映射器的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我在我的 Zend Framework 2 應用程序中添加了模塊 ZfcUser.但我必須使用現有的數據庫表,它的列名與 ZfcUser 的默認表結構略有不同.

                  I`ve added module ZfcUser on my Zend Framework 2 application. But I have to use existing database table, which has slightly different column names than the default table structure for ZfcUser.

                  在 ZfcUser wiki 頁面中,它說可以使用自定義如果我的模型不符合提供的接口,則映射器.而且由于我的數據庫表與默認值不同,因此我的用戶實體類也與標準 ZfcUserEntityUser.但是我可以告訴 ZfcUser 輕松地使用我自己的類通過覆蓋文件 config/autoload/zfcuser.global.php 中的設置:

                  In ZfcUser wiki page it says that it is possible to use custom mapper if my model doesn`t conform to the provided interface. And since my database table is different than default, my user entity class is also different than standard ZfcUserEntityUser. But I can tell ZfcUser to work with my own class easily by overriding setting in file config/autoload/zfcuser.global.php:

                  'user_entity_class' => 'MyAppEntityMyUser',
                  

                  但到目前為止,我還沒有找到一種簡單的方法來告訴 ZfcUser 使用我的映射器類.

                  But I`ve not found an easy way to tell ZfcUser to use my mapper class so far.

                  我只發現映射器是由 ZfcUserModule::getServiceConfig() 創建的在其中,我可以看到映射器是從其工廠函數返回的:

                  I have only found that the mapper is created by ZfcUserModule::getServiceConfig() inside which, I can see the mapper is returned from its factory function:

                  // ...
                  public function getServiceConfig()
                  {
                      return array(
                      // ...
                          'factories' => array(
                              // ...
                              'zfcuser_user_mapper' => function ($sm) {
                                  $options = $sm->get('zfcuser_module_options');
                                  $mapper = new MapperUser();
                                  $mapper->setDbAdapter($sm->get('zfcuser_zend_db_adapter'));
                                  $entityClass = $options->getUserEntityClass();
                                  $mapper->setEntityPrototype(new $entityClass);
                                  $mapper->setHydrator(new MapperUserHydrator());
                                  return $mapper;
                              },
                              // ...
                  

                  有沒有辦法讓 ZfcUser 使用我的自定義用戶映射器類?

                  Is there a way to make ZfcUser to use my custom user mapper class?

                  推薦答案

                  我和你遇到了同樣的問題,但最后還是成功登錄了我的應用程序.我遵循了 Rob 的建議,并在我現有的用戶模塊中創建了自己的服務工廠.不幸的是,伯恩哈德也恰到好處.您必須深入研究 ZfcUser 源代碼才能使其工作.我現在從事的項目有一個 MSSQL 服務器,我必須說處理事情很困難.我最終只調整了 ZfcUser 源代碼中的一個函數來使登錄頁面正常工作.

                  I've had the same problem as you, but managed to log in to my application at last. I followed Rob's advice and created my own service factory within my existing user module. Unfortunately Bernhard is also spot on. You kinda have to dig into the ZfcUser source code to get it to work. The project I am working on now has a MSSQL server and I must say that it's been tough getting a handle on things. I've ended up tweaking only one function in the ZfcUser source to get the login page to work.

                  我只需要當前應用程序的登錄功能,但即將到來的項目更多的是角色驅動.我一直在尋找一種不會太復雜以快速連接的東西,同時為未來提供更多選擇和可能性.

                  I only need log in functionality for the current application, but the upcoming project is much more role driven. I was looking for something that wouldn't be too complicated to hook up quickly, and at the same time offer more options and possibilities for the future.

                  以下是我目前所做的以及我所學到的:

                  Here is what I did for now and what I've learned:

                  我將 Entity 和 Mapper 文件夾從 ZfcUser 目錄復制到我現有的 b2bUser(我的模塊)文件夾中.一切……甚至是 Mapper 中的 Exception 文件夾.可能沒有必要,但我沒心情弄清楚依賴關系.

                  I copied the Entity and Mapper folders from the ZfcUser directory over to my existing b2bUser (my module) folder. Everything...even the Exception folder inside Mapper. It might not be necessary, but I wasn't in the mood to figure out dependencies.

                  在 zfcuser.global.php 文件中,我的活動配置如下所示:

                  In the zfcuser.global.php file, my active configuration looks as follows:

                  'user_entity_class' => 'b2bUserEntityUser',
                  'enable_registration' => false,
                  'enable_username' => true,
                  'auth_identity_fields' => array( 'username' ),
                  'login_redirect_route' => 'home',
                  'enable_user_state' => false,
                  

                  我將其余設置保留為默認值.我從身份驗證中刪除了電子郵件選項,因為他們不會使用電子郵件地址登錄系統.user_entity_class 是我復制的那個...

                  I left the rest of the settings on default. I removed the email option from auth identities because they won't use email addresses to log into the system. The user_entity_class is the one I copied over...

                  Module.php (b2bUser)將以下內容復制到服務管理器配置中:

                  Module.php (b2bUser) Copied the following to the service manager config:

                  'zfcuser_user_mapper' => function ($sm) {
                      $mapper = new MapperUser();
                      $mapper->setDbAdapter($sm->get('ZendDbAdapterAdapter'));
                      $mapper->setEntityPrototype(new EntityUser());
                      $mapper->setHydrator(new MapperUserHydrator());
                      return $mapper;
                  },
                  

                  設置完成后,我更改了 Entity 和 Mapper 中文件的命名空間等,以反映它們的新家.更改實體和接口以反映我自己的數據結構.我對 Mapper 文件做了同樣的處理,并確保 Hydrator 文件中的變量名稱與我的數據庫列名稱相同.

                  After the setup was done, I changed the namespaces, etc of the files in Entity and Mapper to reflect their new home. Changed the Entity and the Interface to reflect my own data structure. I did the same with the Mapper files and made sure the variable names in the Hydrator file is the same as my database column names.

                  我把 AbstractDbMapper 文件留在了原處.但這是我稍微調整了一下的文件.

                  I left the AbstractDbMapper file where it was. But this is the file I tweaked a bit.

                  這是我的樣子.SQLSRV 驅動程序充滿了 pooh,一直在抱怨一個對象或一個字符串......

                  Here is what mine looks like. The SQLSRV driver was full of pooh, complaining the whole time about an object or a string...

                  protected function select(Select $select, $entityPrototype = null, HydratorInterface $hydrator = null)
                  {
                      $this->initialize();
                      $selectString = $this->getSlaveSql()->getSqlStringForSqlObject($select);
                      $stmt = $this->getDbAdapter()->driver->createStatement($selectString);
                      $stmt->prepare();
                      $res = $stmt->execute($stmt);
                  
                      $resultSet = new HydratingResultSet($hydrator ?: $this->getHydrator(),
                              $entityPrototype ?: $this->getEntityPrototype());
                      $resultSet->initialize($res);
                      return $resultSet;
                  }
                  

                  就是這樣.我希望它至少可以幫助某人在他們自己的系統上啟動并運行它.我不會像這樣離開我的,但讓它發揮作用是一項使命.

                  And that is that. I hope it helps someone to get it up and running on their own system at least. I won't leave mine like this, but it was a bit of a mission to get it to work.

                  這篇關于ZF2:ZfcUser 模塊的自定義用戶映射器的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 找不到驅動程序)

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

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

                        <legend id='jvcSG'><style id='jvcSG'><dir id='jvcSG'><q id='jvcSG'></q></dir></style></legend>
                        <tfoot id='jvcSG'></tfoot>

                            <tbody id='jvcSG'></tbody>
                          <i id='jvcSG'><tr id='jvcSG'><dt id='jvcSG'><q id='jvcSG'><span id='jvcSG'><b id='jvcSG'><form id='jvcSG'><ins id='jvcSG'></ins><ul id='jvcSG'></ul><sub id='jvcSG'></sub></form><legend id='jvcSG'></legend><bdo id='jvcSG'><pre id='jvcSG'><center id='jvcSG'></center></pre></bdo></b><th id='jvcSG'></th></span></q></dt></tr></i><div class="tjp7djx" id='jvcSG'><tfoot id='jvcSG'></tfoot><dl id='jvcSG'><fieldset id='jvcSG'></fieldset></dl></div>

                            主站蜘蛛池模板: 仓储笼_金属箱租赁_循环包装_铁网箱_蝴蝶笼租赁_酷龙仓储笼租赁 测试治具|过炉治具|过锡炉治具|工装夹具|测试夹具|允睿自动化设备 | 蓄电池在线监测系统|SF6在线监控泄露报警系统-武汉中电通电力设备有限公司 | 尾轮组_头轮组_矿用刮板_厢式刮板机_铸石刮板机厂家-双驰机械 | PSI渗透压仪,TPS酸度计,美国CHAI PCR仪,渗透压仪厂家_价格,微生物快速检测仪-华泰和合(北京)商贸有限公司 | 阿里巴巴诚信通温州、台州、宁波、嘉兴授权渠道商-浙江联欣科技提供阿里会员办理 | 金属软管_不锈钢金属软管_巩义市润达管道设备制造有限公司 | TPU薄膜_TPU薄膜生产厂家_TPU热熔胶膜厂家定制_鑫亘环保科技(深圳)有限公司 | 山东成考网-山东成人高考网 | 防火阀、排烟防火阀、电动防火阀产品生产销售商-德州凯亿空调设备有限公司 | 手板_手板模型制作_cnc手板加工厂-东莞天泓 | ★店家乐|服装销售管理软件|服装店收银系统|内衣店鞋店进销存软件|连锁店管理软件|收银软件手机版|会员管理系统-手机版,云版,App | 精益专家 - 设备管理软件|HSE管理系统|设备管理系统|EHS安全管理系统 | 气动|电动调节阀|球阀|蝶阀-自力式调节阀-上海渠工阀门管道工程有限公司 | 螺杆真空泵_耐腐蚀螺杆真空泵_水环真空泵_真空机组_烟台真空泵-烟台斯凯威真空 | 安平县鑫川金属丝网制品有限公司,声屏障,高速声屏障,百叶孔声屏障,大弧形声屏障,凹凸穿孔声屏障,铁路声屏障,顶部弧形声屏障,玻璃钢吸音板 | 北京模型公司-工业模型-地产模型-施工模型-北京渝峰时代沙盘模型制作公司 | 琉璃瓦-琉璃瓦厂家-安徽盛阳新型建材科技有限公司 | 深圳高新投三江工业消防解决方案提供厂家_服务商_园区智慧消防_储能消防解决方案服务商_高新投三江 | 磁力加热搅拌器-多工位|大功率|数显恒温磁力搅拌器-司乐仪器官网 | ◆大型吹塑加工|吹塑加工|吹塑代加工|吹塑加工厂|吹塑设备|滚塑加工|滚塑代加工-莱力奇塑业有限公司 | RFID电子标签厂家-上海尼太普电子有限公司 | 高柔性拖链电缆-聚氨酯卷筒电缆-柔性屏蔽电缆厂家-玖泰电缆 | 水篦子|雨篦子|镀锌格栅雨水篦子|不锈钢排水篦子|地下车库水箅子—安平县云航丝网制品厂 | 单电机制砂机,BHS制砂机,制沙机设备,制砂机价格-正升制砂机厂家 单级/双级旋片式真空泵厂家,2xz旋片真空泵-浙江台州求精真空泵有限公司 | 金属管浮子流量计_金属转子流量计厂家-淮安润中仪表科技有限公司 | 碳化硅,氮化硅,冰晶石,绢云母,氟化铝,白刚玉,棕刚玉,石墨,铝粉,铁粉,金属硅粉,金属铝粉,氧化铝粉,硅微粉,蓝晶石,红柱石,莫来石,粉煤灰,三聚磷酸钠,六偏磷酸钠,硫酸镁-皓泉新材料 | 玄米影院| 中宏网-今日新闻-财经新闻| 石牌坊价格石牌坊雕刻制作_石雕牌坊牌楼石栏杆厂家_山东嘉祥石雕有限公司 | 耐驰泵阀管件制造-耐驰泵阀科技(天津)有限公司 | 防勒索软件_数据防泄密_Trellix(原McAfee)核心代理商_Trellix(原Fireeye)售后-广州文智信息科技有限公司 | 电主轴,车床电磨头,变频制动电机-博山鸿达特种电机 | 安徽净化板_合肥岩棉板厂家_玻镁板厂家_安徽科艺美洁净科技有限公司 | 潍坊大集网-潍坊信息港-潍坊信息网| 我爱古诗词_古诗词名句赏析学习平台 | 高铝砖-高铝耐火球-高铝耐火砖生产厂家-价格【荣盛耐材】 | 全自动过滤器_反冲洗过滤器_自清洗过滤器_量子除垢环_量子环除垢_量子除垢 - 安士睿(北京)过滤设备有限公司 | TTCMS自助建站_网站建设_自助建站_免费网站_免费建站_天天向上旗下品牌 | 山东PE给水管厂家,山东双壁波纹管,山东钢带增强波纹管,山东PE穿线管,山东PE农田灌溉管,山东MPP电力保护套管-山东德诺塑业有限公司 | 期货软件-专业期货分析软件下载-云智赢 | 四川成人高考_四川成考报名网|