/** * Persists a document as part of the current unit of work. * * @param object $document The document to persist. * @throws MongoDBException If trying to persist MappedSuperclass. * @throws \InvalidArgumentException If there is something wrong with document's identifier. */ public function persist($document) { $class = $this->dm->getClassMetadata(get_class($document)); if ($class->isMappedSuperclass) { throw MongoDBException::cannotPersistMappedSuperclass($class->name); } $visited = array(); $this->doPersist($document, $visited); }