douju9847 2010-07-14 13:23
浏览 38
已采纳

将Doctrine 2与Zend Framework 1.10.x一起使用

how can i get started with Doctrine 2 + ZF? any tutorials or resources?

on a side note, i hear ZF2 will use Doctrine as its models, true?

  • 写回答

2条回答 默认 最新

  • dpwfh874876 2010-07-14 15:44
    关注

    What's nice about working with ZF and Doctrine 2 is that there's very little that needs to be done to integrate them. Essentially, you just need access to an instance of Doctrine 2's EntityManager that's set up during the applications bootstrap, as well as make sure the Doctrine namespaces are getting loaded in your index.php (You'll need to use Doctrine's ClassLoader for this, Zend_Loader does not support namespaces yet).

    You can instantiate your EntityManager manually in the bootstrap, or even easier, through a Resource Plugin (which makes it easy to store the database config in application.ini). You can pretty much follow the documentation on configuring and obtaining an Entity Manager in Doctrine's manual, and just have the init() method in your bootstrap resource return the instance.

    You're probably going to want to depend highly on dependency injection for passing the EM to the various objects that need it. For an easy way to pass bootstrap resources into your action controllers, see this article on creating a simple resource injector.

    I've been using Doctrine 2 with ZF since it's been in alpha, and have found it quite pleasant to work with.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Llama如何调用shell或者Python
  • ¥20 谁能帮我挨个解读这个php语言编的代码什么意思?
  • ¥15 win10权限管理,限制普通用户使用删除功能
  • ¥15 minnio内存占用过大,内存没被回收(Windows环境)
  • ¥65 抖音咸鱼付款链接转码支付宝
  • ¥15 ubuntu22.04上安装ursim-3.15.8.106339遇到的问题
  • ¥15 blast算法(相关搜索:数据库)
  • ¥15 请问有人会紧聚焦相关的matlab知识嘛?
  • ¥15 网络通信安全解决方案
  • ¥50 yalmip+Gurobi