Skip to content

Should SpeckCommmerce use Doctrine?

EvanDotPro edited this page Sep 1, 2012 · 2 revisions

At the current time the decision is that SpeckCommerce will use Zend\Db and not require Doctrine to run. What we've discovered is that Doctrine is great for a large percentage of simple applications; especially those requiring simple CRUD-type operations with no advanced queries, optimization, or edge cases. Unfortunately e-commerce, by nature, is not simple, and thus we've found we quickly come up against the limitations and confines of Doctrine when trying to make it work. This struggle results in a loss of productivity and implementation of hacks and work-arounds to get more than the intended use out of Doctrine's ORM functionality.

Keep in mind the items below are biased and based on me (Evan) and my team's limited experience trying to be productive with Doctrine. Your mileage may vary.

Doctrine Pros:

  • RAD - Very quick to get started, make entities, etc
  • Schema management, migrations, CLI tools

Doctrine Cons:

  • Lazy-loaded proxies encourage the bad practice of bypassing the service layer for data access in inappropriate places
  • Lazy-loaded proxies create debugging challenges for developers
  • The ORM is not really designed for a modular environment and has some shortcomings in regards to swapping out entities, yet retaining entity meta data (relationships)
  • In our attempts to adopt Doctrine, trying to figure out how to do some more complex things "in Doctrine" proved challenging and incredibly time-consuming
  • It becomes increasingly difficult to optimize queries with joins, groupings, etc, as most things in Doctrine seem to be entirely table/entity-based