you could also move the check to the end of this method, after line 66 where we return $id if one field was empty. (we should however not ignore an invalid name and keep the assigned id - that would be surprising)

for the exception, best wrap the RepositoryException into an IdException. similar to this one (when the name is wrong in a mapping) https://github.com/doctrine/phpcr-odm/blob/master/lib/Doctrine/ODM/PHPCR/Mapping/MappingException.php#L57