Update UnitOfWork.php

This function can fail to find any entityIdentifiers matching the given spl_object_hash, which causes an undefinedIndex exception. This update detects and prevents the problem, and testing this has caused no unexpected side-effects or problems.
This may occur only when using multiple Doctrine connectors simultaneously.