public function persist(object $document) : void
    {
        $class = $this->dm->getClassMetadata(get_class($document));
        if ($class->isMappedSuperclass || $class->isQueryResultDocument) {
            throw MongoDBException::cannotPersistMappedSuperclass($class->name);
        }
        $visited = [];
        $this->doPersist($document, $visited);
    }
public function persist(object $document) : void
    {
        $class = $this->dm->getClassMetadata(get_class($document));
        if ($class->isMappedSuperclass || $class->isQueryResultDocument) {
            throw MongoDBException::cannotPersistMappedSuperclass($class->name);
        }
        $visited = [];
        $this->doPersist($document, $visited);
    }
public function persist ( object $ document ) : void { $ class = $ this -> dm -> getClassMetadata ( get_class ( $ document ) ) ; if ( $ class -> isMappedSuperclass || $ class -> isQueryResultDocument ) { throw MongoDBException :: cannotPersistMappedSuperclass ( $ class -> name ) ; } $ visited = [ ] ; $ this -> doPersist ( $ document , $ visited ) ; }
Persists a document as part of the current unit of work.

@internal

@throws MongoDBException If trying to persist MappedSuperclass.
@throws InvalidArgumentException If there is something wrong with document's identifier.
Persists a document as part of the current unit of work .