[BUGFIX] Fix getIdentifierByObject for lazy doctrine proxy
This bug was introduces with Ib6e1eda1ac38677e84c46a441d099b2c5c1e6e24
and causes the content security functional test to fail. There was no
unit test or other indication for this behaviour, so this change adds
a unit test for the Doctrine persistence manager.
Releases: master, 2.0