okay, i got confused by your initial comment i think ;-)
you do not build the object id anyways, that would be the repository path. the uow method that indeed is called getDocumentId gets you the path by document object, using the spl_object_hash. so you use this to generate a random id, correct? i think spl_object_hash is a bad random id, as its basically the memory pointer to the object. should you not rather just use rand() here, to reduce the probability of a clash as much as possible?