Move error message to constraint
Throw exception if document is not managed by phpcr odm