I’ve been meaning to post this for a long time, ever since I used Propel as part of a Symfony project. Object Relational Mapping or ORM is one tool that I feel most developers do not utilize to the fullest. So here’s a simple primer:
Relational Models make it very easy to address large amounts of data at a stretch. For example, a simple SELECT statement like SELECT name, email FROM user WHERE location LIKE 'Trivandrum'
results in the population of an entire set of values. An OO model OTOH makes it very simple to manipulate discrete entities of data: $user = New User; $user->name = "Vishnu";
offers intuitive getters/setters.
ORM offers the best of both worlds. In Propel, there are two classes for a single table. Peer classes refer to the entire table and perform operations on sets whereas instances of table classes act as getters and setters. Without using SQL and only OO, this simple abstraction offers a lot of flexibilty to any database programmer. Look at the propel documentation for more.
Leave a Reply