TheGooooogle
TheGooooogle

Reputation: 263

Zend Db (standard or table gateway) vs Doctrine in Zend 2 - Pros/Cons

Zend DB (standard way or table gateway) vs Doctrine in Zend 2. Some might say it’s apple vs orange comparison but I would say since they are substitutes (we use one between two) so it can be compared (as requirements are not always crystal clear).

When I started Zend 2 since documentation, books, tutorials were based on Zend DB or Table Gateway, I used it but I was not happy with ways when we have to work on 2, 3 or more tables joins (multiple table gateway adapters) so I switched to Doctrine ORM (also reading so many saying “doctrine is good for large project”). I was already using doctrine in symfony projects so was not difficult but I also didn’t like doctrine in instance like complex joins between entities (extra works), especially slowness and extra memory compared to Zend DB.

Now I am really confused what should I do? So what do you guys suggest?

From my analysis:

Table Gateway

Pros

Cons:

Doctrine

Pros

Cons:

Any others? ( for both)

So, in light of these, which one do you suggest? Working on generic CMS that I can extend.

or why Zend DB cannot/should not be used in larger projects?

I found some discussion here but not as per its pros/cons analysis.

Upvotes: 6

Views: 2480

Answers (3)

Christof Coetzee
Christof Coetzee

Reputation: 77

If the following is important to you then I'd say absolutely go with Zend/Db/*

  1. Performance
  2. Scalability
  3. Low learning curve

Upvotes: 0

albanx
albanx

Reputation: 6335

I did the reverse. I removed Doctrine 2 and switch to Zend DB 2, that improves our queries by a factor of 5x, then we're able to customise some parts of Zend DB table gateway, and we gain 5x more performance on queries (almost as native).

I would say do not use Doctrine if you're gone have large datasets. And remember doctrine consumes a lot of resources.

Upvotes: 2

Mostafa Lavaei
Mostafa Lavaei

Reputation: 2039

I have switch to doctrine after many years, i think it is very better than Zend_Db if you can make it compatible with Zend. Doctrine can migrate your database, it means you can update customers databases to latest version just with one command. Another benefit is your entities can implement in several DBMS like mysql, mssql, mangodb and ...

For more compatibility you can use Raman Framework (this framework add some features to Zend 1.12)

Upvotes: 0

Related Questions