在Symfony2中创建实体而没有教义 [英] Creating Entities in Symfony2 without Doctrine

查看:213
本文介绍了在Symfony2中创建实体而没有教义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的公司保持数据库管理和开发在一个单独的部门和我的Symfony2应用程序我只允许通过服务API与数据库交互。这意味着我不能使用Doctrine ORM甚至php pdo。

My company keeps the database administration and development in a separate department and for my Symfony2 app I am only allowed to interact with the DB via a service API. This means I can't use Doctrine ORM or even php pdo.

我基本上必须构建自己的抽象层。我一直在搜索互联网,没有看到任何关于为Symfony2创建我自己的基本实体abastraction层的最佳实践。我甚至不能找到使用除了Doctrine之外的任何信息。

I basically will have to build my own abstraction layer. I have been searching the internet all day and haven't seen anything about best practices for creating my own basic entity abastraction layer for Symfony2. I can't even find information on using anything but Doctrine.

有没有人有任何建议或知道任何资源的最佳做法这样做symfony2?

Does anyone have any suggestions or know of any resources for best practices on doing this for symfony2?

推荐答案

Symfony是模型独立的(MVC没有M)。请注意,Doctrine或Propel是与Symfony集成的独立项目。它们不是框架的一部分。

Symfony is model independent (There's no 'M' from MVC). Notice that Doctrine or Propel are separate projects integrated with Symfony. They're not part of the framework.

我认为你应该为你的API实现客户端库,这将从框架中解耦(你甚至可以使用它php脚本或其他框架)。

I think you should just implement client library for your API which would be decoupled from the framework (you might even use it in plain php scripts or other framework).

步骤2将整合您的图书馆与Symfony。它可能包括创建一个包和相应的服务定义。看看DoctrineBundle可能会给你一些想法。

Step 2 would be integrating you library with Symfony. It would probably include creating a bundle and appropriate service definitions. Looking at DoctrineBundle might give you some ideas.

这篇关于在Symfony2中创建实体而没有教义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆