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

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

      • <bdo id='UkYpH'></bdo><ul id='UkYpH'></ul>
      1. <legend id='UkYpH'><style id='UkYpH'><dir id='UkYpH'><q id='UkYpH'></q></dir></style></legend>

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

        <tfoot id='UkYpH'></tfoot>

        如何使用 Zend Framework 正確創(chuàng)建域?

        How To Properly Create Domain using Zend Framework?(如何使用 Zend Framework 正確創(chuàng)建域?)

        <small id='7NgiA'></small><noframes id='7NgiA'>

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

            <bdo id='7NgiA'></bdo><ul id='7NgiA'></ul>

                  本文介紹了如何使用 Zend Framework 正確創(chuàng)建域?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我不久前問了這個問題但現(xiàn)在我希望在我的數(shù)據(jù)庫訪問層和域?qū)又g實現(xiàn)實際分離.我還將努力將業(yè)務(wù)邏輯移入它所屬的域中并移出控制器腳本.

                  I asked this question a while back but now I'm looking to implement an actual separation between my database access layer and the domain layer. I am also going to be working to move business logic into the domain where it belongs and out of the controller scripts.

                  我正在使用 Zend Framework,它為數(shù)據(jù)訪問層實現(xiàn)了表數(shù)據(jù)網(wǎng)關(guān)和行數(shù)據(jù)網(wǎng)關(guān)模式,但它顯然沒有真正定義如何構(gòu)建與數(shù)據(jù)訪問層分離的域?qū)?我考慮過使用 Active Record 模式,其中域邏輯與數(shù)據(jù)訪問邏輯共存,但我認為 Active Record 至少會處理以下情況:

                  I'm using Zend Framework which implements the Table Data Gateway and Row Data Gateway patterns for the data access layer, but it apparently fails to really define how to build a domain layer that is separate from the data access layer. I've considered using an Active Record pattern where the domain logic coexists with the data access logic, but I have the following situation that occurs at least once that I don't think Active Record will handle:

                  我有一個包含 person_id 和 userType 字段的Person"表.

                  I have a single table "Person" which contains person_id and userType fields.

                  每個用戶類型(管理員、采購員、助理、主管)都有與之關(guān)聯(lián)的特定業(yè)務(wù)邏輯,并且所有類型都從 Person 對象繼承了一些基本功能.

                  Each userType (admin, buyer, associate, supervisor) has specific business logic associated with it and all types inherit some basic functionality from a Person object.

                  我不想使用專門屬于一種類型用戶的業(yè)務(wù)邏輯來膨脹行數(shù)據(jù)網(wǎng)關(guān)對象,但我不確定如何構(gòu)建域?qū)觼肀硎静煌愋偷挠脩?例如,我是創(chuàng)建一個包含 PersonGateway 對象的 Person 對象,然后編寫將調(diào)用傳遞給網(wǎng)關(guān)對象的包裝函數(shù),還是編寫 Person 對象來擴展 PersonGateway 對象,然后僅實現(xiàn)我需要的特定功能?

                  I don't want to bloat the Row Data Gateway object with business logic that belongs specifically to just one type of user but I'm not certain how to construct the domain layer to represent the different types of users. For example, do I make a Person object that contains the PersonGateway object and then write wrapper functions that pass calls to the gateway object, or do I write the Person object to extend the PersonGateway object and then only implement the specific functions that I need?

                  同樣,我通常認為這是(部分)一個工廠問題,我需要一個工廠方法來實例化基于 userType 的正確子類.這仍然是 Zend Framework 的 Zend_Db 類的最佳方法嗎?

                  Likewise, I would typically think that this is (in part) a factory problem where I need a factory method that will instantiate the correct sub-class based on userType. Is that still the best method here with Zend Framework's Zend_Db class?

                  任何關(guān)于如何在 Zend_Db 之上正確創(chuàng)建域模型的教程的建議或鏈接將不勝感激.

                  Any suggestions or links to tutorials that talk about how to properly create a domain model on top of Zend_Db would be greatly appreciated.

                  推薦答案

                  域模型不擴展任何內(nèi)容.它們只是用于封裝業(yè)務(wù)邏輯的普通類.他們可能使用數(shù)據(jù)訪問對象,所以在類內(nèi)部可能有一個行數(shù)據(jù)網(wǎng)關(guān)對象的protected實例.Row 對象通常比 Table 對象更接近地表示域的實例.此外,您始終可以使用RowgetTable() 方法獲取Table 對象.

                  Domain Models extend nothing. They're just plain classes you use to encapsulate business logic. They may use data access objects, so there may be a protected instance of a row data gateway object inside the class. A Row object usually represents an instance of the domain more closely than a Table object. Besides, you can always get the Table object with the Row's getTable() method.

                  通常,DM 類具有一個接口,其中包含與您可以使用該類執(zhí)行的更高級別操作相對應(yīng)的方法.但您不一定要顯示所有數(shù)據(jù)訪問操作.

                  Typically DM classes have an interface with methods corresponding to higher-level operations you can do with that class. But you don't necessarily want to surface all data access operations.

                  class Person {
                    // Zend_Db_Table_Row object
                    protected $data; 
                  
                    public function subscribeToService(Service $service) { ... }
                  
                    public function sendMailTo(Person $recipient) { ... }
                  
                    public function changePassword($newPassword) { ... }
                  }
                  

                  我去年 春季也寫了關(guān)于這個主題的博客,并在 ZF 郵件列表上寫了它 最近.

                  I also blogged about this subject last spring, and wrote about it on the ZF mailing list recently.

                  就教程和資源而言,請嘗試 http://domaindrivendesign.org/

                  As far as tutorials and resources, try http://domaindrivendesign.org/

                  這篇關(guān)于如何使用 Zend Framework 正確創(chuàng)建域?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網(wǎng)!

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

                  相關(guān)文檔推薦

                  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 和魔術(shù)方法)
                  php pdo get only one value from mysql; value that equals to variable(php pdo 只從 mysql 獲取一個值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅(qū)動程序)
                    <bdo id='GNJna'></bdo><ul id='GNJna'></ul>
                      <tbody id='GNJna'></tbody>
                    <legend id='GNJna'><style id='GNJna'><dir id='GNJna'><q id='GNJna'></q></dir></style></legend>
                      <i id='GNJna'><tr id='GNJna'><dt id='GNJna'><q id='GNJna'><span id='GNJna'><b id='GNJna'><form id='GNJna'><ins id='GNJna'></ins><ul id='GNJna'></ul><sub id='GNJna'></sub></form><legend id='GNJna'></legend><bdo id='GNJna'><pre id='GNJna'><center id='GNJna'></center></pre></bdo></b><th id='GNJna'></th></span></q></dt></tr></i><div class="qwawimqqmiuu" id='GNJna'><tfoot id='GNJna'></tfoot><dl id='GNJna'><fieldset id='GNJna'></fieldset></dl></div>

                        <tfoot id='GNJna'></tfoot>

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

                            主站蜘蛛池模板: 四虎永久免费地址 | 免费在线观看91 | 国产午夜精品一区二区三区嫩草 | 久久com| 国产成人免费 | 亚洲精品一区二区冲田杏梨 | 国产日韩免费视频 | 91国产精品在线 | 精品videossex高潮汇编 | 国产成人av电影 | 在线视频一区二区 | 黄色三级免费网站 | 成人亚洲 | 久久高清| 久久色视频 | 午夜电影福利 | 欧美一级在线观看 | 男人天堂网av | 日韩1区2区 | 国产网站在线免费观看 | 国产欧美日韩精品一区 | 久久久综合色 | 午夜精品久久久久久久久久久久久 | 91在线第一页 | 国产成人精品免费 | 色爱av| 国产成人在线视频免费观看 | 午夜一级大片 | 日韩精品一区二区三区高清免费 | 手机av免费在线 | 欧美日韩理论 | 91影院 | 国产第一页在线观看 | 国产精品69av | 久久夜色精品国产 | 久久视频精品 | 欧美黄在线观看 | 久久精品国产亚洲夜色av网站 | 亚洲成人一区二区在线 | 超碰3| 中文字幕免费 |