doumu1212
2015-11-13 16:17
浏览 53
已采纳

Doctrine 2在MVC ZF2环境中扮演什么角色?

I'm trying to teach myself ZF2 in conjunction with Doctrine 2. I've completed both the Album tutorial and Blog Tutorial on Zend's website successfully. Now I'm trying to go back and convert the Blog Tutorial to use Doctrine 2. I believe I've successfully setup my config for doctrine and used DI to get it inside of my controller (WriteController.php) since I am able to dump the contents of it within my action. I don't get any errors so long as I don't do anything with it.

My question is what roll does Doctrine take in the Controller -> Service -> Mapper -> Backend layered structure which was taught in the Blog tutorial? (Reference To what I mean)

Also, I'm assuming Backend is referring to my Models. Is this correct?

Would I just replace any references to /Blog/Model/Post with /Blog/Entity/Blog?

图片转代码服务由CSDN问答提供 功能建议

我正在尝试将自己的ZF2与Doctrine 2结合起来。我已经完成了专辑教程和博客 Zend网站上的教程成功。 现在我想回去并转换博客教程以使用Doctrine 2.我相信我已成功设置我的配置为doctrine并使用DI将其放入我的控制器(WriteController.php),因为我能够转储 我的行动中的内容。 只要我不对它做任何事情,我就不会收到任何错误。

我的问题是Doctrine在 Controller - >中采用了什么卷? 服务 - > 映射器 - > 博客教程中讲授的后端分层结构? (参考我的意思

另外,我假设 Backend 指的是我的模型。 这是正确的吗?

我是否只需用 / Blog / Entity / Blog 替换对 / Blog / Model / Post 的任何引用?

  • 写回答
  • 好问题 提建议
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • du5739 2015-11-13 19:13
    已采纳

    The Doctrine is the Mapper. And maybe we could say also the Service (through EntityRepository). But usually you will create your own Service Layer.

    The Backend is not the entities it self. Entities in one way to map the several options of backend. As backend you can understand the several options of Relational Databases (Mysql, SqlServer, Oracle, etc) NoSql Databases (like MongoDB), file system and so on.

    I didn't understand your last question. But when I use Doctrine I always create my entities in /MyModule/Entity namespace. While when I use the standart Zend/Db I always create in /MyModule/Model. I do that by standardizing matters.

    已采纳该答案
    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题