removeArticleDetails example

// 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();

        return $product;
    }

    /** * Helper function which converts the passed data for the main variant of the product. * * @param array<string, mixed> $data * * @return array<string, mixed> */

        if (!$this->Request()->has('id')) {
            return;
        }
        $id = (int) $this->Request()->getParam('id');
        $product = $this->getRepository()->find($id);
        if (!$product instanceof Product) {
            return;
        }
        $this->removePrices($product->getId());
        $this->removeArticleEsd($product->getId());
        $this->removeArticleDetails($product);
        $this->removeArticleTranslations($product);

        $this->get('models')->remove($product);
        $this->get('models')->flush();
        $this->View()->assign([
            'data' => $this->Request()->getParams(),
            'success' => true,
        ]);
    }

    /** * Event listener function of the configurator group model of the product backend module. * Fired when the user want to remove a configurator group. * The function requires a passed id to load the shopware model an remove it over the model manager. */
Home | Imprint | This part of the site doesn't use cookies.