Added test based on https://github.com/Ocramius/doctrine2/commit/e468ced00bd107f40fd08beca4c7cc5a2492a418