NYCPHP Meetup

NYPHP.org

[nycphp-talk] Database Abstraction / ORM

Justin Demaris justin.demaris at gmail.com
Mon May 7 08:16:50 EDT 2012


Hello PHP Talkers,

How do you guys feel about ORM systems and other database abstraction
layers? I've been working a lot lately with an older version of Kohana
(fun!) and doing a lot of performance optimization. A good chunk of
improvement has come out of removing reliance on the old Kohana ORM and
replacing it with simple mysqli calls. Is there any ORM system out there
that just does it right? Namely, I'd be looking for things like:

1) When I instantiate an object by it's ID multiple times, it doesn't
bother to hit up the database after the first time, but just keeps giving
me copies of the same object

2) Lazy load the object values. There are a number of patterns where I've
seen people instantiate a bunch of objects and then only use a small subset
of them. It would be nice if the object only loaded the data when we try to
reference one of its non-ID properties.

3) Ability to tweak the back end to work with other database systems
(especially Riak, Mongo and Cassandra)

I have had really good luck in the past working with Yii and integrating
with Redis to use their Active Record structure, but I'm not sure of the
performance there. Also, I've been hearing a lot about Doctrine 2 lately
and the necessity of having an extra Data Mapper layer in the middle that
separates the classes and properties from the fields and tables that store
the data.

Let me know what you guys have experienced, and no pressure since this
decision is probably going to affect my sleep and happiness for a few
years!! ;)

~ Justin DeMaris
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20120507/b2ac55df/attachment.html>


More information about the talk mailing list