Object-relational Mapping

Xyster does ORM (Object-relational mapping). Several PHP projects do the same, and quite well, but we like how we did it better. The Zend Framework itself has the Zend_Db_Table concept, and it's very useful, but it's also very limited. Further, we don’t like the Active Record pattern, and we also wanted to be able to support more than just databases as backends.

Use Any Backend

Our ORM system is based on the Data Mapper design pattern. This pattern allows for you to move data between your objects and their data store without either knowing about each other. The data store can be anything: a database, an LDAP server, an XML document, whatever. Xyster comes with an adapter for use with Zend_Db, but you can quickly write an adapter for any storage system.

Relationships

Take full advantage of one-to-one, one-to-many, and many-to-many relationships in your domain model. The ORM layer will automatically save any changes made to related objects.

Caching

The ORM system can utilize Zend_Cache, so you can persist your objects in Danga's Memcached or PHP's APC for lightning-fast performance.

Concurrent Change Locking

Xyster implements a simple optimistic offline lock using a numeric version field in your entity. The ORM layer will throw an exception if an attempt is made to save changes to an entity that was modified by another session.

Queries

There's also a powerful object query language (to which we lovingly refer as XSQL) that lets you filter and aggregate information from your objects, whether that information comes from a database or a method on the object itself!

Plugins

You can easily write plugins that intercept many events from the ORM layer.

Future Enhancements

There's a lot more planned for the ORM system. Here are just a few features.
  • Integration with Zend_Validate
  • Turn values into Xyster_Enum objects