Refactor EntityToIdentifier stuff into ObjectToIdentifier

Remove hardcoded dependency on Doctrine ORM, and allow instead to register transformer for every persistence type (ORM, ODM, PHPCR).

This is alternative approach to the #1244. Fixes #1199.