doctrine/mongodb-odm — pull request #350 by stof (2012-07-06 22:22:05+00:00)
Title: Common mapping

This refactors the ClassMetadataFactory and the mapping drivers to reuse the code from Doctrine Common 2.3 (the drivers have been added in 2.3 but we need the changes done in doctrine/common#162 for the factory).

As the ODM is not stable, I have not tried to keep the BC at all cost (keeping it entirely is impossible anyway as I switched the drivers to the Common interface), and so I removed the DriverChain instead of keeping a an empty class with this name extending the MappingDriverChain.

The bundle of course need to be updated to support it (it should be BC for the users of the bundle though). I will provide a PR too.

There is one remaining point to discuss: all mapping drivers are now using the MappingException of Doctrine Common (as the exceptions are thrown in common) instead of the previous MongoDBException. But this exception is still used in the factory, in the ClassMetadataInfo and in one place in the AnnotationDriver. This makes it harder to catch them as you need to catch both exception. The ORM used a dedicated MappingException previously for all exceptions related to the mapping (instead of using ORMException in such places) so it was simple and BC: this MappingException simply extends the Common one now. What do you think about using a MappingException in the ODM too ?

[![Build Status](https://secure.travis-ci.org/stof/mongodb-odm.png?branch=common_mapping)](http://travis-ci.org/stof/mongodb-odm)