Deletes all transactional data for a contact.

@param string $email
@param string $collectionName

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

            return $this->execute();
        }
    }
870541
public function upsert($collectionName, array $data)
    {
        $response = $this->doRequest('POST', 'meta/', ['data' => [$collectionName => array($data)]]);
        $body = $response->getBody()->getContents();
        return json_decode($body, true);
    }
428340
public function delete($storageName, $key)
    {
        try {
            $this->conn->delete($this->table, [$this->keyColumn => $key]);
        } catch (\Exception $e) {
        }
    }
1300016
public function deleteDocumentIndexes($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->getDocumentCollection($documentName)->deleteIndexes();
    }
90510
public function clear($documentName = null)
    {
        if ($documentName === null) {
            $this->identityMap =
            $this->documentIdentifiers =
            $this->originalDocumentData =
            $this->documentChangeSets =
            $this->documentStates =
            $this->scheduledForDirtyCheck =
            $this->documentInsertions =
            $this->documentUpserts =
            $this->documentUpdates =
            $this->documentDeletions =
            $this->extraUpdates =
            $this->collectionUpdates =
            $this->collectionDeletions =
            $this->parentAssociations =
            $this->orphanRemovals = array();

            if ($this->commitOrderCalculator !== null) {
                $this->commitOrderCalculator->clear();
            }
        } else {
            $visited = array();
            foreach ($this->identityMap as $className => $documents) {
                if ($className === $documentName) {
                    foreach ($documents as $document) {
                        $this->doDetach($document, $visited, true);
                    }
                }
            }
        }

        if ($this->evm->hasListeners(Events::onClear)) {
            $this->evm->dispatchEvent(Events::onClear, new Event\OnClearEventArgs($this->dm, $documentName));
        }
    }
185555
public function setDbCollection(string $dbName, string $collectionName): \MongoCollection
    {
        return $this->mongoClient->selectDB($dbName)->selectCollection($collectionName);
    }
449847
static function removeCollection( $collectionID )
    {
        if( !is_numeric( $collectionID ) )
        {
            return;
        }

        $db = eZDB::instance();

        $db->query( "DELETE FROM ezinfocollection
                     WHERE id = '$collectionID'" );
        $db->query( "DELETE FROM ezinfocollection_attribute
                     WHERE informationcollection_id = '$collectionID'" );
    }
935180
public function delete($collection = '')
	{
		if (empty($collection))
		{
			throw new \Mongo_DbException("No Mongo collection selected to delete from");
		}

		try
		{
			if ($this->profiling)
			{
				$query = json_encode(array(
				'type'			=> 'delete',
				'collection'	=> $collection,
				'where'			=> $this->wheres,
				));

				$benchmark = \Profiler::start((string) $this->db, $query);
			}

			$this->db->{$collection}->remove($this->wheres, array('fsync' => true, 'justOne' => true));

			if (isset($benchmark))
			{
				\Profiler::stop($benchmark);
			}

			$this->_clear();
			return true;
		}
		catch (\MongoCursorException $e)
		{
			throw new \Mongo_DbException("Delete of data into MongoDB failed: {$e->getMessage()}", $e->getCode());
		}
	}
1258127
public function clearMediaCollectionExcept(string $collectionName = 'default', $excludedMedia = [])
    {
        if ($excludedMedia instanceof Media) {
            $excludedMedia = collect()->push($excludedMedia);
        }

        $excludedMedia = collect($excludedMedia);

        if ($excludedMedia->isEmpty()) {
            return $this->clearMediaCollection($collectionName);
        }

        $this->getMedia($collectionName)
            ->reject(function (Media $media) use ($excludedMedia) {
                return $excludedMedia->where('id', $media->id)->count();
            })
            ->each->delete();

        if ($this->mediaIsPreloaded()) {
            unset($this->media);
        }

        return $this;
    }
1157167
public function deleteRecord($tableName, $value, $field)
    {
        try {
            $this->db->deleteRecord($tableName, $value, $field);
        } catch (\Exception $e) {
            throw new DbException($e->getMessage());
        }
    }
568847
public void dropAllDataMongoDBCollection(String collectionName) {
        DBCollection db = getMongoDBCollection(collectionName);
        DBCursor objectsList = db.find();
        try {
            while (objectsList.hasNext()) {
                db.remove(objectsList.next());
            }
        } finally {
            objectsList.close();
        }
    }
1135192
public function delete($collection = '')
		{
			if (empty($collection)) {
				throw new Exception("No Mongo collection selected to delete from");
			}

			try
			{
				$this->db->{$collection}->remove($this->wheres, array('fsync' => true, 'justOne' => true));

				$this->_clear();

				return true;
			} catch (\MongoCursorException $e) {
				throw new Exception("Delete of data into MongoDB failed: {$e->getMessage()}", $e->getCode());
			}
		}
645815
public function postContactsTransactionalData(
        $data,
        $collectionName = 'Orders'
    ) {
        $order = $this->getContactsTransactionalDataByKey(
            $collectionName,
            $data['id']
        );
        if (!isset($order->key) || isset($order->message)
            && $order->message == self::API_ERROR_TRANS_NOT_EXISTS
        ) {
            $url = $this->getApiEndpoint() . self::REST_TRANSACTIONAL_DATA
                . $collectionName;
        } else {
            $url = $this->getApiEndpoint() . self::REST_TRANSACTIONAL_DATA
                . $collectionName . '/' . $order->key;
        }
        $apiData = [
            'Key' => $data['id'],
            'ContactIdentifier' => $data['email'],
            'Json' => json_encode($data),
        ];

        $this->setUrl($url)
            ->setVerb('POST')
            ->buildPostBody($apiData);
        $response = $this->execute();

        if (isset($response->message)) {
            $message = 'POST CONTACTS TRANSACTIONAL DATA  '
                . $response->message;
            $this->helper->debug('postContactsTransactionalData', [$message]);
            $this->helper->debug('postContactsTransactionalData', $apiData);
        }

        return $response;
    }
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;
    }
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'];
    }
1242678
public function removeContact($databaseID, $email, $sync_fields=false) {
        $data["Envelope"] = array(
            "Body" => array(
                "RemoveRecipient" => array(
                    "LIST_ID" => $databaseID,
                    "EMAIL" => $email,
                ),
            ),
        );
        /*
         * Sync fields are optional so users can target recipients that do not have the EMAIL unique key or no unique keys at all.
         */
        if ( $sync_fields !== FALSE ) {
            foreach ( $sync_fields as $key => $value ) {
                $data['Envelope']['Body']['RemoveRecipient']['COLUMN'][] = array("NAME"=> $key , "VALUE"=> $sync_fields[$key] );
            }

        }

        $response = $this->_request($data);
        $result = $response["Envelope"]["Body"]["RESULT"];
        if ($this->_isSuccess($result)) {
            return true;
        } else {
            if ($response["Envelope"]["Body"]["Fault"]["FaultString"]=="Error removing recipient from list. Recipient is not a member of this list."){
                return true;
            } else {
                throw new \Exception("Silverpop says: ".$response["Envelope"]["Body"]["Fault"]["FaultString"]);
            }
        }
    }
257549
public function deleteContactsAction($accountId, $contactId)
    {
        try {
            // Check if relation exists.
            /** @var AccountContactEntity $accountContact */
            $accountContact = $this->getDoctrine()
                ->getRepository(self::$accountContactEntityName)
                ->findByForeignIds($accountId, $contactId);

            if (!$accountContact) {
                throw new EntityNotFoundException('AccountContact', $accountId . $contactId);
            }
            $id = $accountContact->getId();

            $account = $accountContact->getAccount();

            // Remove main contact when relation with main was removed.
            if ($account->getMainContact() && strval($account->getMainContact()->getId()) === $contactId) {
                $account->setMainContact(null);
            }

            // Remove accountContact.
            $em = $this->getDoctrine()->getManager();
            $em->remove($accountContact);
            $em->flush();

            $view = $this->view($id, 200);
        } catch (EntityNotFoundException $enfe) {
            $view = $this->view($enfe->toArray(), 404);
        }

        return $this->handleView($view);
    }