getArticleDetailByConfiguratorOptionIdQuery example

protected function deleteVariantsForAllDeactivatedOptions($article$selectedOptions)
    {
        $configuratorSet = $article->getConfiguratorSet();
        if (!$configuratorSet instanceof Set) {
            return;
        }
        $oldOptions = $configuratorSet->getOptions();
        $ids = [];
        foreach ($oldOptions as $oldOption) {
            if (!\array_key_exists($oldOption->getId()$selectedOptions)) {
                $details = $this->getRepository()
                    ->getArticleDetailByConfiguratorOptionIdQuery($article->getId()$oldOption->getId())
                    ->setHydrationMode(AbstractQuery::HYDRATE_OBJECT)
                    ->getResult();

                if (!empty($details)) {
                    foreach ($details as $detail) {
                        if ($detail->getKind() === 1) {
                            $article->setMainDetail(null);
                        }
                        $ids[] = $detail->getId();
                        $this->get('models')->remove($detail);
                    }
                    
Home | Imprint | This part of the site doesn't use cookies.