NYCPHP Meetup

NYPHP.org

[nycphp-talk] ORM

csnyder chsnyder at gmail.com
Fri Jan 26 18:52:12 EST 2007


On 1/26/07, Hans C. Kaspersetz <hans at cyberxdesigns.com> wrote:
> I can't believe that my group is the only group on this list that has
> implemented ORM.  If you have implemented ORM, what challenges did you
> face?  And how did you solve them?  What compromises did you choose?
> Were they conscious or unconscious compromises?

The (now sadly defunct) NYPHP Clew project implemented an extremely
limited sort of O/RM. It was really more of a persistent object store,
because everything was stored in one table. Nevertheless, you could
load collections of php objects based on SQL queries, so it was
relational in the sense of "one record to another" rather than
"records in one table to records in another."

The main compromise was that most object properties weren't indexed,
and (worse) had to be looked up using a LIKE comparison, because they
were stored in the database as a serialized, generic php object. On
the other hand, you had complete freedom, as a developer, to create
and use different types of objects without ever changing the database
schema.

That kind of O/RM works great in situations like content management,
where you have a bunch of different kinds of objects which all have
roughly the same basic properties (database schema, things like title
and mimetype) but where you need freedom to add custom properties at
will (like link_color or rsvp_email). Since you generally don't need
to do lookups on those custom properties, the database doesn't need to
know about them.

-- 
Chris Snyder
http://chxo.com/



More information about the talk mailing list