Deletes document(s) matching the given document ID or query

@param string|array|Selection $selection Document ID or a selection
@return array Returns the transaction
778815
public function delete($selection)
    {
        $sel = $selection instanceof Selection ? $selection : new Selection($selection);
        $this->operations[] = ['delete' => $sel->serialize()];
        return $this;
    }
51509
public function documentDelete($parameters = array(), $fetch = self::FETCH_OBJECT)
    {
        $queryParam = new QueryParam();
        $queryParam->setRequired('documentIds');
        $qr = [];
        $stack = [];
        $parametersStack = [];
        foreach ($parameters['documentIds'] as $documentId) {
            $qr[] = "documentIds=$documentId";
            $parametersStack[] = $documentId;
            if (strlen(implode("&", $qr)) > 995) {
                $last = array_pop($qr);
                $qr = [$last];
                $lastParam = array_pop($parametersStack);
                $stack[] = $parametersStack;
                $parametersStack = [$lastParam];
            }
        }

        $stack[] = $parametersStack;
        $responses = [];
        $response = null;
        foreach ($stack as $params) {
            $response = parent::documentDelete(['documentIds' => $params], $fetch);
            if (self::FETCH_PROMISE === $fetch) {
                $responses[] = $response;
            }
            if ($response->getStatusCode() != 204) {
                return $response;
            }
        }
        if (self::FETCH_PROMISE === $fetch) {
            return $responses;
        }
        return $response;
    }
277869
public function deleteAction($articleUuid, $uuid, Request $request)
    {
        $locale = $this->getRequestParameter($request, 'locale', true);

        $documentManager = $this->getDocumentManager();
        $document = $documentManager->find($uuid, $locale);
        $documentManager->remove($document);
        $documentManager->flush();

        return $this->handleView($this->view(null));
    }
272385
public function delete()
    {
        $this->exitIfModelNotSet();

        $params = [
            'id'    => $this->model->getKey(),
            'type'  => $this->model->getDocumentType(),
            'index' => $this->model->getDocumentIndex(),
        ];

        // check if the document exists before deleting
        if ($this->connection->existsStatement($params)) {
            return $this->connection->deleteStatement($params);
        }

        return true;
    }
1246321
public function remove($selector=null)
    {
        $result = $this;
        if ($selector) {
            $result = $result->filter($selector);
        }
        foreach ($result->nodes as $node) {
            if ($node->parentNode) {
                $node->parentNode->removeChild($node);
            }
        }

        $result->nodes = array();
        $result->length = 0;

        return $result;
    }
419384
protected function prepareSubquerySelect(Select $select) {
		$select->reset(Select::LIMIT_OFFSET)
		       ->reset(Select::LIMIT_COUNT)
		       ->reset(Select::ORDER);

		$countSelect = $select->getAdapter()->select()
			->from($select)
			->reset(Select::COLUMNS)
			->columns([self::COUNT_COLUMN => 'count(1)']);

		return $countSelect;
	}
365347
public function delete($docId)
    {
        return $this->montage->request(
            'delete',
            $this->montage->url('document-detail', $this->schema->name, $docId)
        );
    }
1143268
public function remove ($request, $match)
    {
        if (isset($match['collectionId'])) {
            $collectionId = $match['collectionId'];
        } else {
            $collectionId = $request->REQUEST['collectionId'];
        }
        $collection = Pluf_Shortcuts_GetObjectOr404('Collection_Collection', 
                $collectionId);
        if (isset($match['documentId'])) {
            $documentId = $match['documentId'];
        } else {
            $documentId = $request->REQUEST['documentId'];
        }
        $document = Pluf_Shortcuts_GetObjectOr404('Collection_Document', 
                $documentId);
        
        if ($document->collection !== $collection->id) {
            throw new Pluf_Exception_DoesNotExist(
                    'Document with id (' . $documentId .
                             ') does not exist in collection with id (' .
                             $collectionId . ')');
        }
        $documentCopy = Pluf_Shortcuts_GetObjectOr404('Collection_Document', 
                $documentId);
        $document->delete();
        return new Pluf_HTTP_Response_Json($documentCopy);
    }
1088814
public function getSelection($uuid)
    {
        foreach ($this->selections as $selection) {
            if ($selection->getUuid() === $uuid) {
                return $selection;
            }
        }
    }
1154168
public function storage(StorageSelection $selection)
    {
        $callable = $selection->getImpl();

        $arguments = array();
        if (is_array($callable) && isset($callable['arguments'])) {
            $arguments = $callable['arguments'];
            unset($callable['arguments']);
        } elseif (!is_callable($callable)) {
            throw new \InvalidArgumentException('StorageSelection must contain a callable or an extended callable (with arguments) as impl');
        }

        return new ServiceStorage($callable, $arguments);
    }
986015
public function select($select, $distinct = null)
    {
        if (null !== $distinct) {
            $this->distinct($distinct);
        }

        if (empty($select)) {
            return $this;
        }

        $builder = $this->getLookupBuilder();
        $parts = [];
        if (is_array($select)) {
            foreach ($select as $key => $part) {
                if (is_string($part)) {
                    $newSelect = $builder->buildJoin($this, $part);
                    if ($newSelect) {
                        list($alias, $column) = $newSelect;
                        $parts[$key] = $alias.'.'.$column;
                    } else {
                        $parts[$key] = $part;
                    }
                } else {
                    $parts[$key] = $part;
                }
            }
        } elseif (is_string($select)) {
            $newSelect = $builder->buildJoin($this, $select);
            if ($newSelect) {
                list($alias, $column) = $newSelect;
                $parts[$alias] = $column;
            } else {
                $parts[] = $select;
            }
        } else {
            $parts[] = $select;
        }

        $this->sqlParts['select'] = $parts;

        return $this;
    }
56742
public function delete($document, array $options = array())
    {
        $query = $this->getQueryForDocument($document);

        if ($this->class->isLockable) {
            $query[$this->class->lockField] = array('$exists' => false);
        }

        $result = $this->collection->remove($query, $options);

        if (($this->class->isVersioned || $this->class->isLockable) && ! $result['n']) {
            throw LockException::lockFailed($document);
        }
    }
567612
public function delete($collectionName, $condition, $options = [])
    {
        $batchOptions = [];
        foreach (['bypassDocumentValidation'] as $name) {
            if (isset($options[$name])) {
                $batchOptions[$name] = $options[$name];
                unset($options[$name]);
            }
        }

        $this->document = [];
        $this->addDelete($condition, $options);
        $result = $this->executeBatch($collectionName, $batchOptions);

        return $result['result'];
    }
222072
public function clearRowsCache($select)
    {
        $cacheIds = array();
        foreach ($this->getIds($select) as $id) {
            $cacheIds[] = $this->_getCacheId($id);
        }
        Kwf_Cache_Simple::delete($cacheIds);
    }
647103
public static function findAndDelete($id, $select = ['*'])
    {
        $data = static::find($id, $select);

        static::$builder->delete();

        return $data;
    }
195852
public function removeSelection(Selection $selection)
    {
        if ($this->selections->contains($selection)) {
            $this->selections->removeElement($selection);
        }
    }
473777
protected function configureSelector(
        DocumentSelector $selector,
        array $aggregation
    ): DocumentSelector {
        //@see AggregationDefinition
        $query = $aggregation[2];

        //Mounting selection values
        array_walk_recursive($query, function (&$value) {
            if (strpos($value, 'self::') === 0) {
                $value = $this->findValue(substr($value, 6));
            }
        });

        return $selector->where($query);
    }