Deletes a piece of transactional data by key.

@param int  $key
@param string $collectionName

@return null
@throws \Exception
485614
public function deleteContactsTransactionalData(
        $key,
        $collectionName = 'Orders'
    ) {
        if ($key && $collectionName) {
            $url = $this->getApiEndpoint() . '/v2/contacts/transactional-data/'
                . $collectionName . '/' . $key;
            $this->setUrl($url)
                ->setVerb('DELETE');

            $response = $this->execute();

            if (isset($response->message)) {
                $this->helper->debug(
                    'deleteContactsTransactionalData',
                    ['DELETE CONTACTS TRANSACTIONAL DATA : ' . $url
                        . ' ' . $response->message]
                );
            }

            return $response;
        }
    }
747340
function del($key)
    {
        parent::del($key);

        try {
            $this->collection->deleteOne([
                'key'   => $key,
                'realm' => $this->getRealm(),
            ]);
        } catch (\Exception $e) {
            throw new exWriteError($e->getMessage(), $e->getCode(), $e);
        }
    }
369736
public void delete(Collection collection) {
        pm.currentTransaction().begin();
        pm.deletePersistentAll(collection);
        pm.currentTransaction().commit();
    }
187853
public function remove($collectionName, array $criteria = [], array $options = []) {
		$collection = $this->getCollection($collectionName);
		
		if ($this->_profilerEnabled) {
			$message = 'db.remove(' . json_encode($criteria) . ');';
			$event   = $this->getProfiler()->startDelete($message);
		}

		$result  = $collection->remove($criteria, $options);
		$success = (bool) $result['ok'];
		
		if ($this->_profilerEnabled) {
			$success
				? $event->stopSuccess()
				: $event->stopError();
		}
		
		return $success;
	}
52236
public function canDelete($collection_id)
    {
        $sql = 'SELECT collection_item_id FROM collection_item WHERE collection_id=?';
        $result = $this->db->fetchColumn($sql, array($collection_id));
        return empty($result);
    }
1075771
protected function deleteValue($key)
    {
        $this->db->getCollection($this->cacheCollection)->remove(['id' => $key]);
        return true;
    }
981410
public function deleteCollectionItem($collectionId, $itemId, $accessToken)
    {
        if (!$this->apiVersionIsGreaterThanV3()) {
            throw new EndpointNotSupportedByApiVersionException();
        }

        if (!is_string($itemId)) {
            throw new InvalidTypeException('Item ID', 'string', gettype($itemId));
        }

        return $this->delete(sprintf('collections/%s/items/%s', $collectionId, $itemId), [], $accessToken);
    }
276174
public function dropIndexes($collectionName, $indexes)
    {
        $this->document = $this->db->getQueryBuilder()->dropIndexes($collectionName, $indexes);

        return current($this->execute()->toArray());
    }
955026
public function clear($entityName = null)
    {
        if ($entityName === null) {
            $this->identityMap =
            $this->entityIdentifiers =
            $this->originalEntityData =
            $this->entityChangeSets =
            $this->entityStates =
            $this->scheduledForSynchronization =
            $this->entityInsertions =
            $this->entityUpdates =
            $this->entityDeletions =
            $this->collectionDeletions =
            $this->collectionUpdates =
            $this->extraUpdates =
            $this->readOnlyObjects =
            $this->visitedCollections =
            $this->orphanRemovals = array();

            if ($this->commitOrderCalculator !== null) {
                $this->commitOrderCalculator->clear();
            }
        } else {
            $visited = array();

            foreach ($this->identityMap as $className => $entities) {
                if ($className !== $entityName) {
                    continue;
                }

                foreach ($entities as $entity) {
                    $this->doDetach($entity, $visited, false);
                }
            }
        }

        if ($this->evm->hasListeners(Events::onClear)) {
            $this->evm->dispatchEvent(Events::onClear, new Event\OnClearEventArgs($this->em, $entityName));
        }
    }
1065296
public function removeItem(string $key) : void
    {
        $this->checkCallback();
        if (isset($this->members[$key])) {
            unset($this->members[$key]);
        } else {
            throw new CollectionException('Unable to remove from collection - key ' . $key . ' not found.');
        }
    }
224866
public function deleteByField($fieldName, $keys)
    {
        $keys = (array)$keys;
        if (empty($keys)) {
            return;
        }
        //Filter relations so we don't delete records which this one only belongs to
        $relations = array_filter(
            $this->entity->getRelations(),
            function (Relation $relation) {
                return !$relation instanceof Relation\BelongsTo;
            }
        );
        if (empty($relations)) {
            $this->manager->postPendingQuery(
                new PendingQuery(
                    $this->entity,
                    PendingQuery::TYPE_DELETE,
                    $this->queryBuilder
                        ->delete($this->entity->getTable())
                        ->where($this->equalsExpression($fieldName, $keys)),
                    $this->parameters
                )
            );
        } else {
            $this->deleteRecords(
                $this->with(array_keys($relations))
                     ->getByField($fieldName, $keys)
            );
        }
    }
329049
protected function deleteRelation(
        EntityInterface $entity,
        EntityCollectionInterface $collection
    ) {
        $repository = $this->getParentRepository();
        $adapter = $repository->getAdapter();
        $parts = explode('\\', $this->getEntityDescriptor()->className());
        $entityName = lcfirst(array_pop($parts));
        $parts = explode('\\', $this->getParentEntityDescriptor()->className());
        $relatedName = lcfirst(array_pop($parts));
        $value = $collection->parentEntity()->getId();
        Sql::createSql($adapter)
            ->delete($this->getRelationTable())
            ->where(
                [
                    "{$this->getRelatedForeignKey()} = :{$relatedName} AND
                     {$this->getForeignKey()} = :{$entityName}" => [
                        ":{$relatedName}" => $entity->getId(),
                        ":{$entityName}" => $value
                    ]
                ]
            )
            ->execute();
        return $this;
    }
1293448
public function getCollection($collectionName)
    {
        $this->initialize();

        return isset($this->collections[$collectionName]) ? $this->collections[$collectionName] : null;
    }
1028927
public void delete(final Collection<K> keys) throws SQLException {
        transactionTemplate
            .doInTransaction(new SQLFunction<Connection, Object>() {
                @Override
                public Object apply(Connection connection) throws SQLException {
                    delegate.delete(connection, keys);
                    return null;
                }
            });
    }
194638
protected function deleteByKey($id, string $key = null): int
    {
        $key = empty($key) ? $this->repository->getModel()->getKeyName() : $key;

        $row = 0;

        try {
            $row = $this->queryRelate->whereIn($key, (array) $id)->getQuery()->delete();
        } catch (\RuntimeException $exception) {
            throw new ResourceDeleteException($exception->getMessage(), $exception->getCode(), $exception);
        } finally {
            $this->resetQueryRelate();
        }

        return $row;
    }
1042690
public function forget($key)
    {
        list($baseKey, $searchKey) = $this->fetchKey($key);

        $registry = $this->get($baseKey);

        if ($registry === null) {
            $registry = $this->cache->get($baseKey);
        }

        if (is_null($registry)) {
            throw new Exception("Item [$key] does not exists");
        }

        if ($baseKey !== $searchKey)
        {
            array_forget($registry, $searchKey);
            $this->database->table($this->config['table'])->where('key', '=', $baseKey)->update(array('value' => json_encode($registry)));

            // Update cache
            $this->cache->add($baseKey, $registry);
        }
        else
        {
            $this->database->table($this->config['table'])->where('key', '=', $baseKey)->delete();

            // Remove from cache
            $this->cache->remove($baseKey);
        }

        return true;
    }
639074
public function hasKey($key, $collection)
    {
        if (empty($this->queriesResultCache[ 'collectionKeys' ][ $collection ])) {
            $this->getKeys($collection);
        }

        return (bool)in_array($key, $this->queriesResultCache[ 'collectionKeys' ][ $collection ]);
    }