ODS - ObjectDocument Serializer

bsonSerialize() which returns an array to store as a BSON document

bsonUnserialize($array) which receives a BSON document just like the one returned by the serialize method

I don't like ORMs . I really don't. It's not just because all of the ORM frameworks I've seen make mockery out of performance needs, but they also tend to be extremely over-engineered, which makes me want to cry. I'd wager that most people using ORMs are actually solving the wrong problem with the wrong solution, simply because there wasn't a better alternative for their data-modeling needs and the benefits of adopting an ORM outweighed its inherent problems.It's like driving a gasoline-hungry car. You say that you care about its MPG rating, but you are still wasting a lot of gas without ever looking back. It is just a cost of living. Or insurance: You know you can save 15% or more... but you don't. You've accepted that bi-annual rip-off as cost of living.Just like using an ORM, you have accepted the pain as cost of living. Well, I don't :)The new MongoDB PHP driver includes an experimental ODS interface ( BSON\Persistable ) that allows you to automatically store your object as documents in MongoDB the way you see fit. And the best part? When you retrieve the document from MongoDB, the driver will know which class it represented and can reconstruct the object (again, the way you see fit).All you have to do is implement the two methods of the BSON\Persistable interface:That's it! There is no special way of querying by type, parent object, or any of those weird things that ORMs have introduced to work around storing objects or documents in databases. Your document is your object. Your relations are your relations.If you would like to build on top of this functionality, it's trivial to implement a trait that implements both methods and provides basic change tracking . At that point, we are entering ORM and ODM territory and are going beyond what we should ask from an extension. All we want from an extension is performance, and simplicity.