What do you mean by "handled by UnitOfWork commit" ? Whether the SQL is "scheduled" or executed immediately? Interesting question.
Scheduling would probably be better but also more difficult.
As far as usage is concerned, I currently imagine it as follows:
$user = $em->getReference($userId); $address = $em->getReference($addressId); $em->link($user, 'addresses', $address);
"What happens if: an entity is linked with a collection, although they are already connected."
Probably an SQL error which results in an exception from the driver. Depends on the database constraints though.
"What happens if: an entity is unlinked from a collection it is not in"
Probably nothing, at least not from the SQL side. An exception could be thrown from Doctrine itself if the update affected 0 rows.
Thanks for these initial questions. Thats definitely food for thought. Keep it coming.