久久久久久久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)建域?的處理方法,對(duì)大家解決問題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)吧!

                  問題描述

                  我不久前問了這個(gè)問題但現(xiàn)在我希望在我的數(shù)據(jù)庫(kù)訪問層和域?qū)又g實(shí)現(xiàn)實(shí)際分離.我還將努力將業(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ù)訪問層實(shí)現(xiàn)了表數(shù)據(jù)網(wǎng)關(guān)和行數(shù)據(jù)網(wǎng)關(guān)模式,但它顯然沒有真正定義如何構(gòu)建與數(shù)據(jù)訪問層分離的域?qū)?我考慮過使用 Active Record 模式,其中域邏輯與數(shù)據(jù)訪問邏輯共存,但我認(rèn)為 Active Record 至少會(huì)處理以下情況:

                  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:

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

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

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

                  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)對(duì)象,但我不確定如何構(gòu)建域?qū)觼肀硎静煌愋偷挠脩?例如,我是創(chuàng)建一個(gè)包含 PersonGateway 對(duì)象的 Person 對(duì)象,然后編寫將調(diào)用傳遞給網(wǎng)關(guān)對(duì)象的包裝函數(shù),還是編寫 Person 對(duì)象來擴(kuò)展 PersonGateway 對(duì)象,然后僅實(shí)現(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?

                  同樣,我通常認(rèn)為這是(部分)一個(gè)工廠問題,我需要一個(gè)工廠方法來實(shí)例化基于 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.

                  推薦答案

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

                  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 類具有一個(gè)接口,其中包含與您可以使用該類執(zhí)行的更高級(jí)別操作相對(duì)應(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)于這個(gè)主題的博客,并在 ZF 郵件列表上寫了它 最近.

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

                  就教程和資源而言,請(qǐng)嘗試 http://domaindrivendesign.org/

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

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

                  【網(wǎng)站聲明】本站部分內(nèi)容來源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(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 可滾動(dòng)游標(biāo)不起作用)
                  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 獲取一個(gè)值;等于變量的值)
                  MSSQL PDO could not find driver(MSSQL PDO 找不到驅(qū)動(dòng)程序)
                    <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'>

                            主站蜘蛛池模板: 精品国产乱码久久久久久88av | 99精品久久 | 亚洲国产福利 | 午夜成人在线视频 | 免费精品| 在线播放国产精品 | 亚洲一区在线免费观看 | 久久亚洲精品视频 | 日韩av免费在线观看 | 中文在线一区 | 成人在线视频免费 | 国产精品日韩欧美 | 色多多视频在线观看 | 中文字幕综合网 | www.久久久 | 婷婷激情五月 | 国产成人一区二区 | 国产一级片视频 | 免费观看av | 久久一区 | 波多野结衣视频在线 | 欧美一区二区视频在线观看 | 黄网免费看 | 亚洲精品成人 | 日韩欧美第一页 | 天堂免费av | 色精品| 亚洲精品国产精品国自产观看 | 免费在线观看av | 午夜免费av | 亚洲久久久 | 亚洲国产精品久久 | 免费毛片在线播放免费 | 成人在线视频观看 | 国产精品福利在线 | 国产一区二区在线播放 | 在线一区视频 | 中文字幕二区 | 国产三级一区 | 99爱视频 | 深夜福利在线播放 |