3 ms·
Small nitpick: If you're using a non-relational database, the library you use to connect to it is not an object-relational mapping layer.
by chc 15y ago
Small nitpick: If you're using a non-relational database, the library you use to connect to it is not an object-relational mapping layer.
- SeoxyS 15y agoYou have a point! I guess I'm bastardizing the definition of an ORM. What I mean by it was a library that automatically maps the data layer to objects in your application code, and (often) gives you tools to work with these objects. I wrote an "ORM" for MongoDB which adds functionality such as transparent relationships.[1] Basically, even though it's not a relational db, it lets you do things like this: foreach ($author->books as $book) // ^ ^ this is a Book object // ^ this is an iterator, it loads a // Book object lazily every iteration. echo $book->author->name; // ^ this is an Author object, auto- // matically & lazily loaded & cached. [1]: https://github.com/kballenegger/MongoModel https://github.com/kballenegger/MongoModel Among other many cool features. The point of highlighting that though, was to illustrate that giving up traditional RDBMS doesn't mean giving up on awesome relationships. The only thing missing is subqueries—but honestly, I don't think that's a very big loss.