Doctrine PHPCR-ODM now handles versioning

The Doctrine PHPCR-ODM allows you to easily map your PHP objects onto content repository nodes. Since last week, the PHPCR-ODM leverages the versioning support of PHPCR in the ODM layer. This gives your application a very simple way to work with versioned content.

The versioning is pretty simple to use. DocumentManager::find() will always give you the current version of the document. The DocumentManager provides access to old versions with getAllLinearVersions($document) and findVersionByName($class, $id, $name). The later gives you a detached document with the values it had when the specified version was created. Using checkin/checkout/checkpoint you generate versions. Finally there is restoreVersion and removeVersion to restore the document to an old version resp. to remove something from the version history.

An example should help understanding the workflow: