Download xPDO 1.0-beta-290 now
After being focused on developing MODx Revolution 2.0 on top of xPDO, a lot has been going on here with no communication about those changes affecting xPDO. Let's resolve that right now and discuss the large number of changes since the initial beta release, some 215 revisions later.
No ado about much...
Many improvements and new features have crept into xPDO in the process of developing MODx Revolution. There have been over 200 commits since the 1.0-beta-75 release, and I've all but ignored them here until now. I'll be working on documentation and updating it frequently over the next couple of months, but here are some highlights from the changes:
- Registering packages with configurable base path locations for more efficient class/map loading
- xPDO class now accepts an array of options instead of just a tablePrefix for various uses
- A great number of improvements and new capabilities in the transport packaging code
- Refactored the object caching features to allow any xPDOQuery to cache results by signature and primary key(s).
- Refactored xPDOObject::set() method to allow third parameter, vType, to be of type callable. When this parameter is a valid callable, the responsibility of setting the value of the appropriate xPDOObject::$_fields array element becomes that of the callback function. The callback should accept three parameters, the key of the field, the value to set, and a reference to the xPDOObject instance, (i.e. $this).
- Introduced xPDO::getObjectLoader() method to allow xPDOObject derivatives to provide overridden loadObject() and loadCollection() static methods (i.e. a workaround for not having late static binding capabilities)
- Added lazy loading of object fields. You can now use all xPDO getObject* and getCollection* functions to load objects with only certain fields populated. Data for other attributes will be loaded when requested via the xPDOObject get() method.
- Introduced xPDOObject validation which can be defined at design-time via schema and/or run-time via API.
- Refactored xPDOQuery::hydrateGraph() to take a PDOStatement object it can iterate over instead of an array of the entire result set. This should reduce the memory usage on xPDO::getCollectionGraph() calls considerably. xPDOObject::loadCollectionGraph() was updated to pass the statement.
Again, these are just highlights, but should illustrate the point that a lot of work has been going on despite the inactivity on this web site.