Deletes variant records

@param string $sOXID Article ID
344595
protected function _deleteVariantRecords($sOXID)
    {
        if ($sOXID) {
            $database = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
            //collect variants to remove recursively
            $query= 'select oxid from ' . $this->getViewName() . ' where oxparentid = ?';
            $rs = $database->select($query, [$sOXID]);
            $oArticle = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
            if ($rs != false && $rs->count() > 0) {
                while (!$rs->EOF) {
                    $oArticle->setId($rs->fields[0]);
                    $oArticle->delete();
                    $rs->fetchRow();
                }
            }
        }
    }
1267671
public function deleteVariant()
    {
        $editObjectOxid = $this->getEditObjectId();
        $editObject = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
        $editObject->load($editObjectOxid);
        if ($editObject->isDerived()) {
            return;
        }

        $this->resetContentCache();

        $variantOxid = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestRawParameter("voxid");
        $variant = oxNew(\OxidEsales\Eshop\Application\Model\Article::class);
        $variant->delete($variantOxid);
    }
1120924
protected static function delete_categories(array $contextids, array $categoriesids) {
        global $DB;

        if (!$categoriesids) {
            return;
        }

        list($categoryidstest, $catparams) = $DB->get_in_or_equal($categoriesids, SQL_PARAMS_NAMED, 'cfcat');
        $datasql = "SELECT d.id FROM {customfield_data} d JOIN {customfield_field} f ON f.id = d.fieldid " .
            "WHERE f.categoryid $categoryidstest";
        $fieldsql = "SELECT f.id AS fieldid FROM {customfield_field} f WHERE f.categoryid $categoryidstest";

        self::before_delete_data("IN ($datasql)", $catparams);
        self::before_delete_fields($categoryidstest, $catparams);

        $DB->execute('DELETE FROM {customfield_data} WHERE fieldid IN (' . $fieldsql . ')', $catparams);
        $DB->execute("DELETE FROM {customfield_field} WHERE categoryid $categoryidstest", $catparams);
        $DB->execute("DELETE FROM {customfield_category} WHERE id $categoryidstest", $catparams);

    }
346591
protected function removeCategoryArticles($articles, $categoryID)
    {
        $db = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();
        $prodIds = implode(", ", \OxidEsales\Eshop\Core\DatabaseProvider::getDb()->quoteArray($articles));

        $delete = "delete from oxobject2category ";
        $where = $this->getRemoveCategoryArticlesQueryFilter($categoryID, $prodIds);


        $sQ = $delete . $where;
        $db->execute($sQ);

        // updating oxtime values
        $this->_updateOxTime($prodIds);
    }
1287209
public function deleteByRoot( $rootId = null, array $except = array() )
    {
        if ( null === $rootId )
        {
            $where = array( new Predicate\IsNull(
                'rootParagraphId'
            ) );
        }
        else
        {
            $where = array(
                'rootParagraphId' => (int) $rootId,
            );
        }

        if ( ! empty( $except ) )
        {
            $where[] = new Predicate\NotIn( 'id', $except );
        }

        $delete = $this->sql()
                       ->delete()
                       ->where( $where );

        $result = $this->sql()
                       ->prepareStatementForSqlObject( $delete )
                       ->execute();

        return $result->getAffectedRows();
    }
411248
public function deleteGroupAssignmentsForType($typeId, $status)
    {
        $q = $this->dbHandler->createDeleteQuery();
        $q->deleteFrom(
            $this->dbHandler->quoteTable('ezcontentclass_classgroup')
        )->where(
            $q->expr->lAnd(
                $q->expr->eq(
                    $this->dbHandler->quoteColumn('contentclass_id'),
                    $q->bindValue($typeId, null, \PDO::PARAM_INT)
                ),
                $q->expr->eq(
                    $this->dbHandler->quoteColumn('contentclass_version'),
                    $q->bindValue($status, null, \PDO::PARAM_INT)
                )
            )
        );
        $q->prepare()->execute();
    }
36181
public function load($sOXID)
    {
        $aData = $this->_loadFromDb($sOXID);

        if ($aData) {
            $this->assign($aData);
            $this->_isLoaded = true;
            return true;
        }

        return false;
    }
184495
protected function delete_files($questionid, $contextid) {
        global $DB;
        $fs = get_file_storage();

        parent::delete_files($questionid, $contextid);

        $this->delete_files_in_combined_feedback($questionid, $contextid);
        $this->delete_files_in_hints($questionid, $contextid);
    }
1287166
public function delete($recordingId)
    {
        if (ArrayOperations::checkNull([$recordingId])) {
            throw
            new PlivoValidationException(
                'recording id is mandatory');
        }
        $this->client->delete(
            $this->uri . $recordingId . '/',
            []
        );
    }
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;
    }
1159243
protected function delete_files($questionid, $contextid) {
        global $DB;
        $fs = get_file_storage();

        parent::delete_files($questionid, $contextid);

        $dragids = $DB->get_records_menu('qtype_ddimageortext_drags',
                                                array('questionid' => $questionid), 'id', 'id,1');
        foreach ($dragids as $dragid => $notused) {
            $fs->delete_area_files($contextid, 'qtype_ddimageortext', 'dragimage', $dragid);
        }

        $this->delete_files_in_combined_feedback($questionid, $contextid);
        $this->delete_files_in_hints($questionid, $contextid);
    }
606256
public function delete($productId, ProductVariant &$productVariant)
    {
        $endpoint = '/admin/products/'.$productId.'/variants/'.$productVariant->id.'.json';
        $response = $this->request($endpoint, 'DELETE');
    }
1142050
public function delete($sOXID = null)
    {
        if (!$sOXID) {
            $sOXID = $this->getId();
        }

        if (parent::delete($sOXID)) {
            \OxidEsales\Eshop\Core\Registry::get(\OxidEsales\Eshop\Application\Model\SeoEncoderContent::class)->onDeleteContent($sOXID);

            return true;
        }

        return false;
    }
1082614
private function removeOldEvents($beforeId)
    {
        $oldEvents = $this->eventCollection
            ->addFieldToFilter('event_id', ['lteq' => $beforeId]);

        $oldEvents->walk('delete');

        return $this;
    }
700672
public function cleanup( array $siteids )
	{
		$context = $this->_getContext();
		$config = $context->getConfig();
		$search = $this->createSearch();

		$path = 'classes/catalog/manager/submanagers';
		foreach( $config->get( $path, array( 'list' ) ) as $domain ) {
			$this->getSubManager( $domain )->cleanup( $siteids );
		}

		$dbm = $context->getDatabaseManager();
		$dbname = $this->_getResourceName();
		$conn = $dbm->acquire( $dbname );

		try
		{
			$path = 'mshop/catalog/manager/default/item/delete';
			$sql = $config->get( $path, $path );

			$types = array( 'siteid' => MW_DB_Statement_Abstract::PARAM_STR );
			$translations = array( 'siteid' => '"siteid"' );

			$search->setConditions( $search->compare( '==', 'siteid', $siteids ) );
			$sql = str_replace( ':siteid', $search->getConditionString( $types, $translations ), $sql );

			$stmt = $conn->create( $sql );
			$stmt->bind( 1, 0, MW_DB_Statement_Abstract::PARAM_INT );
			$stmt->bind( 2, 0x7FFFFFFF, MW_DB_Statement_Abstract::PARAM_INT );
			$stmt->execute()->finish();

			$dbm->release( $conn, $dbname );
		}
		catch( Exception $e )
		{
			$dbm->release( $conn, $dbname );
			throw $e;
		}
	}
586568
public function delete($sOxId = null)
    {
        if (!$sOxId) {
            $sOxId = $this->getId();
        }
        if (!$sOxId) {
            return false;
        }

        $oDb = \OxidEsales\Eshop\Core\DatabaseProvider::getDb();

        $sOxIdQuoted = $oDb->quote($sOxId);
        $oDb->execute('delete from oxobject2payment where oxobjectid = ' . $sOxIdQuoted);
        $oDb->execute('delete from oxobject2delivery where oxdeliveryid = ' . $sOxIdQuoted);
        $oDb->execute('delete from oxdel2delset where oxdelsetid = ' . $sOxIdQuoted);

        return parent::delete($sOxId);
    }
1265945
public function exists($sOXID = null)
    {
        if (!$sOXID) {
            $sOXID = $this->getId();
        }
        //#5901 if physical record exists return true unconditionally
        if (parent::exists($sOXID)) {
            $this->setId($sOXID);
            return true;
        }

        //additional username check
        //This part is used by not yet saved user object, to detect the case when such username exists in db.
        //Basically it is called when anonymous visitor enters existing username for newsletter subscription
        //see Newsletter::send()
        //TODO: transfer this validation to newsletter part
        $sShopSelect = '';
        if (!$this->_blMallUsers && $this->oxuser__oxrights->value != 'malladmin') {
            $sShopSelect = ' AND oxshopid = "' . \OxidEsales\Eshop\Core\Registry::getConfig()->getShopId() . '" ';
        }

        // We force reading from master to prevent issues with slow replications or open transactions (see ESDEV-3804).
        $masterDb = \OxidEsales\Eshop\Core\DatabaseProvider::getMaster();
        $sSelect = 'SELECT oxid FROM ' . $this->getViewName() . '
                    WHERE ( oxusername = ' . $masterDb->quote($this->oxuser__oxusername->value) . ' ) ';
        $sSelect .= $sShopSelect;

        if (($sOxid = $masterDb->getOne($sSelect))) {
            // update - set oxid
            $this->setId($sOxid);

            return true;
        }

        return false;
    }