Deletes and rebuilds any tables used by IncrementGenerator and/or AlnumGenerator
instances associated with the specified document class.

@param string $documentName
775530
public function rebuildGeneratorTablesFor($documentName)
    {
        $class  = $this->dm->getClassMetadata($documentName);
        $tables = $this->getGeneratorTablesFor($class);

        foreach ($tables as $tableName => $definition) {
            $this->doDeleteTable($tableName, $definition);
            $this->doCreateTable($tableName, $definition);
        }
    }
788436
public function removeAllListeners(string $eventName = null)
    {
        if (\is_null($eventName)) {
            $this->listeners = [];
            $this->wildcardListeners = [];
        } else {
            if ('*' === $eventName[\strlen($eventName) - 1]) {
                // Wildcard event
                unset($this->wildcardListeners[\substr($eventName, 0, -1)]);
            } else {
                unset($this->listeners[$eventName]);
            }
        }

        // Reset index
        $this->listenerIndex = [];
    }
471014
public function delete($id)
    {
        if ($id instanceof Zend_Search_Lucene_Search_QueryHit) {
            /* @var $id Zend_Search_Lucene_Search_QueryHit */
            $id = $id->id;
        }

        if ($id >= $this->_docCount) {
            include_once 'Zend/Search/Lucene/Exception.php';
            throw new Zend_Search_Lucene_Exception('Document id is out of the range.');
        }

        $segmentStartId = 0;
        foreach ($this->_segmentInfos as $segmentInfo) {
            if ($segmentStartId + $segmentInfo->count() > $id) {
                break;
            }

            $segmentStartId += $segmentInfo->count();
        }
        $segmentInfo->delete($id - $segmentStartId);

        $this->_hasChanges = true;
    }
826177
private function rebuild($className)
    {
        $instance = new $className;

        if (method_exists($instance, 'countCaches')) {
            $this->info("Rebuilding [$className] count caches");
            $countCache = new CountCache($instance);
            $countCache->rebuild();
        }

        if (method_exists($instance, 'sumCaches')) {
            $this->info("Rebuilding [$className] sum caches");
            $sumCache = new SumCache($instance);
            $sumCache->rebuild();
        }
    }
1022549
public function find(?string $documentName = null) : self
    {
        $this->setDocumentName($documentName);
        $this->query['type'] = Query::TYPE_FIND;

        return $this;
    }
1011757
public function delete()
    {
        if (!$this->isLoaded()) {
            //Nothing to do, do we need an exception here?
            return;
        }

        $this->dispatch('delete', new DocumentEvent($this));

        //Performing deletion
        $this->odm->collection(static::class)->deleteOne(['_id' => $this->primaryKey()]);
        $this->setField('_id', null, false);
        //Done with deletion

        $this->dispatch('deleted', new DocumentEvent($this));
    }
193471
public function addNode(string $className): void
    {
        if (isset($this->nodes[$className])) {
            return;
        }

        $this->nodes[$className] = new DocumentGraphNode($className);
    }
689497
public function delete($document): void
    {
        $class = $this->dm->getClassMetadata(get_class($document));
        $id = $class->getSingleIdentifier($document);

        $this->collection->delete((string) $id);
    }
1138420
@Nonnull
  public T delete(
      @Nonnull DocumentReference documentReference, @Nonnull Precondition precondition) {
    return performDelete(documentReference, precondition);
  }
209403
public function dropDocumentCollection($documentName)
    {
        $class = $this->dm->getClassMetadata($documentName);
        if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
            throw new \InvalidArgumentException('Cannot delete document indexes for mapped super classes or embedded documents.');
        }
        $this->dm->getDocumentDatabase($documentName)->dropCollection(
            $class->getCollection()
        );
    }
638138
public function delete($node)
    {
        if (!$node instanceof ReadNodeInterface) {
            throw new IndexorWrongParameterException();
        }

        $index = $this->client->getIndex($this->indexName);
        $type = $index->getType(NodeSchemaGenerator::INDEX_TYPE);
        $document = $this->transformer->transform($node);
        try {
            $type->deleteDocument($document);
            $index->refresh();
        } catch (NotFoundException $e) {

        }
    }
826691
private function cascadeRemove(object $document, array &$visited) : void
    {
        $class = $this->dm->getClassMetadata(get_class($document));
        foreach ($class->fieldMappings as $mapping) {
            if (! $mapping['isCascadeRemove'] && ( ! isset($mapping['orphanRemoval']) || ! $mapping['orphanRemoval'])) {
                continue;
            }
            if ($document instanceof GhostObjectInterface && ! $document->isProxyInitialized()) {
                $document->initializeProxy();
            }

            $relatedDocuments = $class->reflFields[$mapping['fieldName']]->getValue($document);
            if ($relatedDocuments instanceof Collection || is_array($relatedDocuments)) {
                // If its a PersistentCollection initialization is intended! No unwrap!
                foreach ($relatedDocuments as $relatedDocument) {
                    $this->doRemove($relatedDocument, $visited);
                }
            } elseif ($relatedDocuments !== null) {
                $this->doRemove($relatedDocuments, $visited);
            }
        }
    }
388858
public function deleteIndex($indexName)
    {
        $this->mapProviders(function (SearchProviderInterface $provider) use ($indexName) {
            try {
                $provider->deleteIndex($this->indexNamePrefix . $indexName);
            } catch (\Exception $e) {
                // we don’t care
            }
        });
    }
583424
public function deregisterDocument($document)
    {
        $oid = $this->getObjectIdentifier($document);
        $this->assertDocumentExists($document);
        $nodeIdentifier = $this->documentNodeMap[$oid];
        $locale = $this->documentLocaleMap[$oid];

        unset($this->nodeMap[$nodeIdentifier]);
        unset($this->nodeDocumentMap[$this->getNodeLocaleKey($nodeIdentifier, $locale)]);
        unset($this->documentMap[$oid]);
        unset($this->documentNodeMap[$oid]);
        unset($this->documentLocaleMap[$oid]);
        unset($this->hydrationState[$oid]);
    }
1293347
public function delete(CategoryDeleteEvent $event, $eventName, EventDispatcherInterface $dispatcher)
    {
        if (null !== $category = CategoryQuery::create()->findPk($event->getCategoryId())) {
            $con = Propel::getWriteConnection(CategoryTableMap::DATABASE_NAME);
            $con->beginTransaction();

            try {
                $fileList = ['images' => [], 'documentList' => []];

                // Get category's files to delete after category deletion
                $fileList['images']['list'] = CategoryImageQuery::create()
                    ->findByCategoryId($event->getCategoryId());
                $fileList['images']['type'] = TheliaEvents::IMAGE_DELETE;

                $fileList['documentList']['list'] = CategoryDocumentQuery::create()
                    ->findByCategoryId($event->getCategoryId());
                $fileList['documentList']['type'] = TheliaEvents::DOCUMENT_DELETE;

                // Delete category
                $category
                    ->setDispatcher($dispatcher)
                    ->delete($con);

                $event->setCategory($category);

                // Dispatch delete category's files event
                foreach ($fileList as $fileTypeList) {
                    foreach ($fileTypeList['list'] as $fileToDelete) {
                        $fileDeleteEvent = new FileDeleteEvent($fileToDelete);
                        $dispatcher->dispatch($fileTypeList['type'], $fileDeleteEvent);
                    }
                }

                $con->commit();
            } catch (\Exception $e) {
                $con->rollback();
                throw $e;
            }
        }
    }
884476
public function createDocumentTableFor($documentName)
    {
        $class = $this->dm->getClassMetadata($documentName);

        if ($class->isMappedSuperclass || $class->isEmbeddedDocument) {
            throw ODMException::cannotCreateMappedSuperclassTable($documentName);
        }

        $this->doCreateTable($class->getTableName(), $class->getDefinitionTable());
    }
827200
public function clearIndex($indexName = null)
    {
        $indexName = $this->resolveIndexName($indexName);

        $this->elasticsearch->indices()->delete(['index' => $indexName]);
    }