Adds document to next flush.

@param object $document
19194
public function persist($document)
    {
        $documentArray = $this->converter->convertToArray($document);
        $type = $this->getMetadataCollector()->getDocumentType(get_class($document));

        $this->bulk('index', $type, $documentArray);
    }
553017
public function setDocument(\Innova\CollecticielBundle\Entity\Document $document)
    {
        $this->document = $document;

        return $this;
    }
813881
public function attach($document)
    {
        if (isset($this->connection)) {
            $document = $this->connection->unmarshall($document);
        }

        // wrap document as NObject instance to make sure it can be override by hooks
        $document = new NObject($document);

        $this->applyHook('attaching', $document);

        if (isset($this->options['model'])) {
            $Model = $this->options['model'];
            $model = new $Model($document->toArray(), array(
                'collection' => $this,
            ));
        } else {
            $model = new Model($document->toArray(), array(
                'collection' => $this,
            ));
        }

        $this->applyHook('attached', $model);

        return $model;
    }
568883
public function insert(&$document) {

        if (isset($document[0])) {

            $this->database->connection->beginTransaction();

            foreach ($document as &$doc) {

                if (!\is_array($doc)) continue;

                $res = $this->_insert($doc);

                if (!$res) {
                    $this->database->connection->rollBack();
                    return $res;
                }
            }
            $this->database->connection->commit();
            return \count($document);
        } else {
            return $this->_insert($document);
        }
    }
318780
public function repair($document, $text): void
    {
        if ($document instanceof Document) {
            $document = $document->getId();
        }

        $this->getClient()->call(null, $document, self::ENDPOINT, OriginalFile::class, false, 'POST', sprintf(
                '/repair?repair_description=%s', urlencode($text))
        );
    }
58835
protected function persist($object)
    {
        if(!$object->getId()) {
            $object->setId($this->getNextId());
        }
        $key = $this->getHash().$object->getId();
        $content = serialize($object);
        
        $this->getFileManager()->write($key, $content, true);
    }
187017
public function add($documents)
    {

        $pendingRemove = $this->getRemove();
        if ($this->getRemove()) {
            if ($this->all()) {
                throw new \RuntimeException('Adding to group with pending remove is not permitted');
            } else {
                $this->clearAdd();
                $this->clearRemove();
                $this->saved = array();
            }
        }
        if (!is_array($documents)) {
            $documents = array($documents);
        }

        $add =& $this->getArchive()->getByRef('add', array());
        foreach ($documents as $document) {
            $add[] = $document;
        }
    }
1067093
public function addDocument(Document $document, string $opType = null): self
    {
        $action = AbstractDocumentAction::create($document, $opType);

        return $this->addAction($action);
    }
78538
private function indexDocument($document)
    {
        if (!$document instanceof StructureBehavior) {
            return;
        }

        if ($document instanceof SecurityBehavior && !empty($document->getPermissions())) {
            return;
        }

        $this->searchManager->index($document);
    }
119366
public function save(&$document) {

        return isset($document['_id']) ? $this->update(array('_id' => $document['_id']), $document) : $this->insert($document);
    }
265270
public function handleFlush(FlushEvent $event)
    {
        foreach ($this->persistEvents as $persistEvent) {
            $document = $persistEvent->getDocument();
            $structure = $this->documentToStructure($document);

            $event = new ContentNodeEvent($this->documentInspector->getNode($document), $structure);
            $this->eventDispatcher->dispatch(ContentEvents::NODE_POST_SAVE, $event);
        }

        $this->persistEvents = [];
    }
1218740
public function setDocumentData(array $document)
    {
        $this->set('__date__', new \MongoDate);
        $this->set('__documentId__', $document['_id']);
        
        unset($document['_id']);
        
        $this->merge($document);
        
        
        return $this;
    }
1332712
@Override
   void addDocuments(Document[] docs) throws IOException
   {
      for (int i = 0; i < docs.length; i++)
      {
         Document old = pending.put(docs[i].get(FieldNames.UUID), docs[i]);
         if (old != null)
         {
            Util.disposeDocument(old);
         }
         if (pending.size() >= bufferSize)
         {
            commitPending();
         }
         numDocs++;
      }
      invalidateSharedReader();
   }
9154
public function lock(object $document, int $lockMode) : void
    {
        $id          = $this->uow->getDocumentIdentifier($document);
        $criteria    = ['_id' => $this->class->getDatabaseIdentifierValue($id)];
        $lockMapping = $this->class->fieldMappings[$this->class->lockField];
        assert($this->collection instanceof Collection);
        $this->collection->updateOne($criteria, ['$set' => [$lockMapping['name'] => $lockMode]]);
        $this->class->reflFields[$this->class->lockField]->setValue($document, $lockMode);
    }
1010235
public function addDocuments(
        $documents,
        $allowDups = false,
        $overwritePending = true,
        $overwriteCommitted = true,
        $commitWithin = 0
    ) {
        $overwriteVal = $allowDups ? 'false' : 'true';
        $commitWithin = (int) $commitWithin;
        $commitWithinString = $commitWithin > 0 ? " commitWithin=\"{$commitWithin}\"" : '';

        $rawPost = "<add overwrite=\"{$overwriteVal}\"{$commitWithinString}>";
        foreach ($documents as $document) {
            if ($document instanceof \Apache_Solr_Document) {
                $rawPost .= $this->_documentToXmlFragment($document);
            }
        }
        $rawPost .= '</add>';

        return $this->add($rawPost);
    }
533235
public function flush()
    {
        if (!empty($this->documents)) {
            $this->resource->addDocuments($this->storeId, $this->documents);
            $this->clearDocuments();
        }
    }
172340
void add_document(Document doc)
    {
        doc.feature().normalize();
        documents_.add(doc);
        composite_.add_vector(doc.feature());
    }