getRemoveESDQuery example



        $product = $this->getRepository()->find($id);

        if (!$product instanceof ProductModel) {
            throw new NotFoundException(sprintf('Product by "id" %d not found', $id));
        }

        // Delete associated data         $query = $this->getRepository()->getRemovePricesQuery($product->getId());
        $query->execute();
        $query = $this->getRepository()->getRemoveESDQuery($product->getId());
        $query->execute();
        $query = $this->getRepository()->getRemoveArticleTranslationsQuery($product->getId());
        $query->execute();

        $sql = 'DELETE FROM s_articles_translations WHERE articleID = ?';
        $this->getManager()->getConnection()->executeQuery($sql[$product->getId()]);

        $this->removeArticleDetails($product);

        $this->getManager()->remove($product);
        $this->flush();

        
$query = $this->getRepository()->getRemoveAttributesQuery($articleDetailId);
        $query->execute();
    }

    /** * Internal helper function to remove the detail esd configuration quickly. * * @param int $articleId */
    protected function removeArticleEsd($articleId)
    {
        $query = $this->getRepository()->getRemoveESDQuery($articleId);
        $query->execute();
    }

    /** * @param Product $article */
    protected function removeArticleDetails($article)
    {
        $sql = 'SELECT id FROM s_articles_details WHERE articleID = ? AND kind != 1';
        $details = Shopware()->Db()->fetchAll($sql[$article->getId()]);

        
Home | Imprint | This part of the site doesn't use cookies.