Delete an existing smart_collection

@link   https://help.shopify.com/api/reference/smartcollection#destroy
@param  SmartCollection $smartCollection
@return void
516737
public function delete(SmartCollection $smartCollection)
    {
        $request = $this->createRequest('/admin/smart_collections/'.$smartCollection->getId().'.json', static::REQUEST_METHOD_DELETE);
        $this->send($request);
    }
1133928
private function removeFromCollection(&$collection, $items)
    {
        if (is_array($collection)) {
            foreach ($items as $item) {
                foreach ($collection as $index => $v) {
                    if (spl_object_hash($item) == spl_object_hash($v)) {
                        unset($collection[$index]);
                    }
                }
            }
        } else {
            foreach ($items as $item) {
                $collection->removeElement($item);
            }
        }
    }
1334884
public function deleteProductCategories($collection)
	{
		$timeStamp = time();
		if (!is_array($collection)) {
			return $this->createException('InvalidParameterValueException', 'Invalid parameter value. Parameter must be an array collection', 'E:S:001');
		}
		$countDeleted = 0;
		foreach ($collection as $entry) {
			if ($entry instanceof BundleEntity\ProductCategory) {
				$this->em->remove($entry);
				$countDeleted++;
			} else {
				$response = $this->getProductCategory($entry);
				if (!$response->error->exist) {
					$this->em->remove($response->result->set);
					$countDeleted++;
				}
			}
		}
		if ($countDeleted < 0) {
			return new ModelResponse(null, 0, 0, null, true, 'E:E:001', 'Unable to delete all or some of the selected entries.', $timeStamp, time());
		}
		$this->em->flush();
		return new ModelResponse(null, 0, 0, null, false, 'S:D:001', 'Selected entries have been successfully removed from database.', $timeStamp, time());
	}
529570
public function delete()
    {
        if ($this->cID > 0) {
            $db = Loader::db();

            // First we delete all versions
            $vl = new VersionList($this);
            $vl->setItemsPerPage(-1);
            $vlArray = $vl->getPage();

            foreach ($vlArray as $v) {
                $v->delete();
            }

            $cID = $this->getCollectionID();

            $q = "delete from CollectionAttributeValues where cID = {$cID}";
            $db->query($q);

            $q = "delete from Collections where cID = '{$cID}'";
            $r = $db->query($q);

            try {
                $q = "delete from CollectionSearchIndexAttributes where cID = {$cID}";
                $db->query($q);
            } catch (\Exception $e) {
            }
        }
    }
1261264
public function removeTeams(ArrayCollection $teams)
    {
        foreach ($teams as $team) {
            $team->removeUser($this);
            $this->teams->removeElement($team);
        }
    }
994480
def delete_collection(self, collection):
        
        uri = str.join('/', [self.uri, collection])
        return self.service._delete(uri)
399213
function removeItem( $itemID )
    {
        $item = eZProductCollectionItem::fetch( $itemID );
        if ( is_object( $item ) && $this->attribute( 'productcollection_id' ) == $item->attribute( 'productcollection_id' ) )
        {
            $item->remove();
        }
    }
471374
public function delete($key)
	{
	    $this->validateKey($key);

		if (isset($this->items[$key])) {
			unset($this->items[$key]);
		} else {
			throw new InvalidKeyException("Collection key '".$key."' does not exist.");
		}
	}
425269
private function deleteElements(object $parent, array $collections, array $options) : void
    {
        $pathCollMap   = [];
        $paths         = [];
        $deleteDiffMap = [];

        foreach ($collections as $coll) {
            $coll->initialize();
            if (! $this->uow->isCollectionScheduledForUpdate($coll)) {
                continue;
            }
            $deleteDiff = $coll->getDeleteDiff();

            if (empty($deleteDiff)) {
                continue;
            }
            [$propertyPath ] = $this->getPathAndParent($coll);

            $pathCollMap[$propertyPath]   = $coll;
            $paths[]                      = $propertyPath;
            $deleteDiffMap[$propertyPath] = $deleteDiff;
        }

        $paths        = $this->excludeSubPaths($paths);
        $deleteColls  = array_intersect_key($pathCollMap, array_flip($paths));
        $unsetPayload = [];
        $pullPayload  = [];
        foreach ($deleteColls as $propertyPath => $coll) {
            $deleteDiff = $deleteDiffMap[$propertyPath];
            foreach ($deleteDiff as $key => $document) {
                $unsetPayload[$propertyPath . '.' . $key] = true;
            }
            $pullPayload[$propertyPath] = null;
        }

        if (! empty($unsetPayload)) {
            $this->executeQuery($parent, ['$unset' => $unsetPayload], $options);
        }
        if (empty($pullPayload)) {
            return;
        }

        /**
         * @todo This is a hack right now because we don't have a proper way to
         * remove an element from an array by its key. Unsetting the key results
         * in the element being left in the array as null so we have to pull
         * null values.
         */
        $this->executeQuery($parent, ['$pull' => $pullPayload], $options);
    }
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);
    }
1144362
public function delete($target, $keepDuplicates = true)
    {
        // We need a copy of $this->collection, not itself:
        $array = $this->collection;

        foreach ($array as $index => $value) {
            if ($value == $target) {
                unset($array[$index]);

                if ($keepDuplicates === true) {
                    break;
                }
            }
        }

        // Now override original stack with replaced one
        $this->collection = $array;
    }
705326
public function invalidateResourceCollection($version = null, FilterInterface $filter = null)
    {
        $this->cache->deleteItem($this->getResourceCollectionKey($version, $filter));
    }
1282198
public function delete(object $parent, array $collections, array $options) : void
    {
        $unsetPathsMap = [];

        foreach ($collections as $collection) {
            $mapping = $collection->getMapping();
            if ($mapping['isInverseSide']) {
                continue; // ignore inverse side
            }
            if (CollectionHelper::isAtomic($mapping['strategy'])) {
                throw new UnexpectedValueException($mapping['strategy'] . ' delete collection strategy should have been handled by DocumentPersister. Please report a bug in issue tracker');
            }
            [$propertyPath]               = $this->getPathAndParent($collection);
            $unsetPathsMap[$propertyPath] = true;
        }

        if (empty($unsetPathsMap)) {
            return;
        }

        /** @var string[] $unsetPaths */
        $unsetPaths = array_keys($unsetPathsMap);

        $unsetPaths = array_fill_keys($this->excludeSubPaths($unsetPaths), true);
        $query      = ['$unset' => $unsetPaths];
        $this->executeQuery($parent, $query, $options);
    }
1257127
public function removePages(ArrayCollection $pages)
    {
        foreach ($pages as $page) {
            $page->removeApp($this);
            $this->pages->removeElement($page);
        }
    }
702071
public function removeApps(ArrayCollection $apps)
    {
        foreach ($apps as $app) {
            $app->removePage($this);
            $this->apps->removeElement($app);
        }
    }
353890
public function deleteCollection($collectionId, ?int $status = null): void
    {
        // Delete all connections between blocks and collections

        $query = $this->connection->createQueryBuilder();
        $query
            ->delete('ngbm_block_collection')
            ->where(
                $query->expr()->eq('collection_id', ':collection_id')
            )
            ->setParameter('collection_id', $collectionId, Type::INTEGER);

        if ($status !== null) {
            $this->applyStatusCondition($query, $status, 'collection_status');
        }

        $query->execute();

        // Then delete the collection itself

        $query = $this->connection->createQueryBuilder();
        $query->delete('ngbm_collection')
            ->where(
                $query->expr()->eq('id', ':id')
            )
            ->setParameter('id', $collectionId, Type::INTEGER);

        if ($status !== null) {
            $this->applyStatusCondition($query, $status);
        }

        $query->execute();
    }
226958
protected function removeCollection(Collection $collection, array $options = []) {
		$ids = $collection->_id;
		
		if (count($ids) !== $collection->count()) {
			throw new Exceptions\OperationError('Some of the models has no ID');
		}
		
		$ids = array_map([$this, 'normalizeId'], $ids);
		
		return $this->getAdapter()->remove(
			$this->getTableName(),
			['_id' => [
				'$in' => $ids
			]],
			$options
		);
	}