public function generate($document, ClassMetadata $cm, DocumentManagerInterface $dm, $parent = null)
    {
        $id = $cm->getFieldValue($document, $cm->identifier);
        if (!$id) {
            throw new IdException('ID could not be read from the document instance using the AssignedIdGenerator.');
        }

        return $id;
    }
public function generate($document, ClassMetadata $cm, DocumentManagerInterface $dm, $parent = null)
    {
        $id = $cm->getFieldValue($document, $cm->identifier);
        if (!$id) {
            throw new IdException('ID could not be read from the document instance using the AssignedIdGenerator.');
        }

        return $id;
    }
public function generate ( $ document , ClassMetadata $ cm , DocumentManagerInterface $ dm , $ parent = null ) { $ id = $ cm -> getFieldValue ( $ document , $ cm -> identifier ) ; if ( ! $ id ) { throw new IdException ( 'ID could not be read from the document instance using the AssignedIdGenerator.' ) ; } return $ id ; }
Use the identifier field as id and throw exception if not set.

{@inheritdoc}
Use the identifier field as id and throw exception if not set .