Clint
Clint

Reputation: 2891

Creating Entities in Symfony2 without Doctrine

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.

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.

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

Upvotes: 7

Views: 5618

Answers (3)

Dienow
Dienow

Reputation: 1415

It seems to me that the API might be perceived as another DB driver. I suppose that doctrine can be extended to accept custom db driver, yet I'm not sure how much effort it'll take and whether your API provides all the necessary functionality. Obvious pros of such approach is that you would be able to use the same doctrine's features as you would have if you had a PDO access.

Upvotes: 0

mikayel ghazaryan
mikayel ghazaryan

Reputation: 716

I did it following way:

Please feel free to contact me for more details.

Upvotes: 6

Jakub Zalas
Jakub Zalas

Reputation: 36191

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.

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

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.

Upvotes: 6

Related Questions