you should use $dm->getUnitOfWork()->getObjectIdentifier($obj) and not the metadata method. 

we will deprecate the metadata->getIdentifierValue method in phpcr-odm 1.1, it makes little sense (its not even guaranteed that the id is mapped to the document, as parent and name completely identify the document). see also https://github.com/doctrine/phpcr-odm/pull/368