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

<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="kgyiusu" 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 正確創建域?

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

        <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="okgii62" 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 正確創建域?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

                  問題描述

                  我不久前問了這個問題但現在我希望在我的數據庫訪問層和域層之間實現實際分離.我還將努力將業務邏輯移入它所屬的域中并移出控制器腳本.

                  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,它為數據訪問層實現了表數據網關和行數據網關模式,但它顯然沒有真正定義如何構建與數據訪問層分離的域層.我考慮過使用 Active Record 模式,其中域邏輯與數據訪問邏輯共存,但我認為 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.

                  每個用戶類型(管理員、采購員、助理、主管)都有與之關聯的特定業務邏輯,并且所有類型都從 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.

                  我不想使用專門屬于一種類型用戶的業務邏輯來膨脹行數據網關對象,但我不確定如何構建域層來表示不同類型的用戶.例如,我是創建一個包含 PersonGateway 對象的 Person 對象,然后編寫將調用傳遞給網關對象的包裝函數,還是編寫 Person 對象來擴展 PersonGateway 對象,然后僅實現我需要的特定功能?

                  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?

                  任何關于如何在 Zend_Db 之上正確創建域模型的教程的建議或鏈接將不勝感激.

                  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.

                  推薦答案

                  域模型不擴展任何內容.它們只是用于封裝業務邏輯的普通類.他們可能使用數據訪問對象,所以在類內部可能有一個行數據網關對象的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 類具有一個接口,其中包含與您可以使用該類執行的更高級別操作相對應的方法.但您不一定要顯示所有數據訪問操作.

                  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) { ... }
                  }
                  

                  我去年 春季也寫了關于這個主題的博客,并在 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/

                  這篇關于如何使用 Zend Framework 正確創建域?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持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 找不到驅動程序)
                    <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="wgk4242" 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'>

                            主站蜘蛛池模板: 艺术涂料_进口艺术涂料_艺术涂料加盟_艺术涂料十大品牌 -英国蒙太奇艺术涂料 | 喷漆房_废气处理设备-湖北天地鑫环保设备有限公司 | 黑龙江京科脑康医院-哈尔滨精神病医院哪家好_哈尔滨精神科医院排名_黑龙江精神心理病专科医院 | 土壤水分自动监测站-SM150便携式土壤水分仪-铭奥仪器 | 自动气象站_农业气象站_超声波气象站_防爆气象站-山东万象环境科技有限公司 | 玻纤土工格栅_钢塑格栅_PP焊接_单双向塑料土工格栅_复合防裂布厂家_山东大庚工程材料科技有限公司 | 薪动-人力资源公司-灵活用工薪资代发-费用结算-残保金优化-北京秒付科技有限公司 | 变压器配件,变压器吸湿器,武强县吉口变压器配件有限公司 | lcd条形屏-液晶长条屏-户外广告屏-条形智能显示屏-深圳市条形智能电子有限公司 | 可程式恒温恒湿试验箱|恒温恒湿箱|恒温恒湿试验箱|恒温恒湿老化试验箱|高低温试验箱价格报价-广东德瑞检测设备有限公司 | 高压负荷开关-苏州雷尔沃电器有限公司| 宝元数控系统|对刀仪厂家|东莞机器人控制系统|东莞安川伺服-【鑫天驰智能科技】 | 武汉宣传片制作-视频拍摄-企业宣传片公司-武汉红年影视 | 肉嫩度仪-凝胶测试仪-国产质构仪-气味分析仪-上海保圣实业发展有限公司|总部 | 杰福伦_磁致伸缩位移传感器_线性位移传感器-意大利GEFRAN杰福伦-河南赉威液压科技有限公司 | 发电机价格|发电机组价格|柴油发电机价格|柴油发电机组价格网 | 网站建设-临朐爱采购-抖音运营-山东兆通网络科技 | 北京遮阳网-防尘盖土网-盖土草坪-迷彩网-防尘网生产厂家-京兴科技 | 高铝轻质保温砖_刚玉莫来石砖厂家_轻质耐火砖价格 | 正压送风机-多叶送风口-板式排烟口-德州志诺通风设备 | 医院专用门厂家报价-医用病房门尺寸大全-抗菌木门品牌推荐 | 井式炉-台车式回火炉-丹阳市电炉厂有限公司 | 施工围挡-施工PVC围挡-工程围挡-深圳市旭东钢构技术开发有限公司 | 粉末冶金注射成型厂家|MIM厂家|粉末冶金齿轮|MIM零件-深圳市新泰兴精密科技 | 便携式XPDM露点仪-在线式防爆露点仪-增强型烟气分析仪-约克仪器 冰雕-冰雪世界-大型冰雕展制作公司-赛北冰雕官网 | 通用磨耗试验机-QUV耐候试验机|久宏实业百科 | EPK超声波测厚仪,德国EPK测厚仪维修-上海树信仪器仪表有限公司 | 轴承振动测量仪电箱-轴承测振动仪器-测试仪厂家-杭州居易电气 | 河南mpp电力管_mpp电力管生产厂家_mpp电力电缆保护管价格 - 河南晨翀实业 | 聚合氯化铝厂家-聚合氯化铝铁价格-河南洁康环保科技 | 吉祥新世纪铝塑板_生产铝塑板厂家_铝塑板生产厂家_临沂市兴达铝塑装饰材料有限公司 | 亚克隆,RNAi干扰检测,miRNA定量检测-上海基屹生物科技有限公司 | 砂尘试验箱_淋雨试验房_冰水冲击试验箱_IPX9K淋雨试验箱_广州岳信试验设备有限公司 | 无线讲解器-导游讲解器-自助讲解器-分区讲解系统 品牌生产厂家[鹰米讲解-合肥市徽马信息科技有限公司] | 讲师宝经纪-专业培训机构师资供应商_培训机构找讲师、培训师、讲师经纪就上讲师宝经纪 | 深圳美安可自动化设备有限公司,喷码机,定制喷码机,二维码喷码机,深圳喷码机,纸箱喷码机,东莞喷码机 UV喷码机,日期喷码机,鸡蛋喷码机,管芯喷码机,管内壁喷码机,喷码机厂家 | 济南品牌包装设计公司_济南VI标志设计公司_山东锐尚文化传播 | 天津次氯酸钠酸钙溶液-天津氢氧化钠厂家-天津市辅仁化工有限公司 | QQ房产导航-免费收录优秀房地产网站_房地产信息网 | 吨袋包装机|吨包秤|吨包机|集装袋包装机-烟台华恩科技 | 贴片电容代理-三星电容-村田电容-风华电容-国巨电容-深圳市昂洋科技有限公司 |