Consider an entity with a (unidirectional) manyToOne association:
EntityX:
type: entity
table: x
id:
id:
type: integer
Short answer: Upgrade to Doctrine 2.2. EntityY->getId() will no longer trigger loading of the class.
I did see some code a long time ago which showed how to reach into the UnitOfWork object and pull this out. Can't find it. Might try searching the Doctrine2 user mailing list. But given that 2.2 fixes this problem, I would just live with the loading until I could upgrade.