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

    • <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="qwawimqqmiuu" 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="qwawimqqmiuu" 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="qwawimqqmiuu" id='jvcSG'><tfoot id='jvcSG'></tfoot><dl id='jvcSG'><fieldset id='jvcSG'></fieldset></dl></div>

                            主站蜘蛛池模板: 精品91久久久 | 日韩精品在线视频免费观看 | 亚洲第一免费播放区 | av在线视 | 香蕉久久a毛片 | 国产一区久久久 | 中文字幕高清 | 成人免费看片 | 黄色一级大片在线观看 | 亚洲精品一区二区三区丝袜 | 夫妻午夜影院 | 浮生影院免费观看中文版 | 黄色在线免费观看 | 一级在线毛片 | 天天看天天爽 | 欧美成人精品激情在线观看 | 中文字幕高清 | 成人午夜影院 | 日韩av一区二区在线 | 国产成都精品91一区二区三 | 色婷婷综合久久久中字幕精品久久 | 亚洲综合在线一区 | 久久国产日韩欧美 | 国产精品一区一区 | 日韩三级电影一区二区 | 亚洲欧美成人影院 | 操亚洲| 亚洲精品福利视频 | 亚洲视频二区 | 国产区精品 | 欧美成人一区二免费视频软件 | 日韩a在线 | 国产一区二区三区四区五区加勒比 | 亚洲精品1| 久草欧美视频 | 精品网 | 中文字幕在线网 | 国产精品久久久久久久久久妞妞 | 日韩在线免费观看视频 | 亚洲欧美日韩精品久久亚洲区 | 欧美日韩一 |