ConfiguratorOption example

throw new CustomValidationException(sprintf('ConfiguratorOption by id "%s" not found', $optionData['id']));
                        }
                    } else {
                        $option = $this->getManager()->getRepository(ConfiguratorOption::class)->findOneBy([
                            'name' => $optionData['name'],
                            'groupId' => $group->getId(),
                        ]);
                    }
                }

                if (!$option) {
                    $option = new ConfiguratorOption();
                }

                $option->fromArray($optionData);
                $option->setGroup($group);

                // Only set new position if option doesn't exist yet                 // Otherwise the position might have been set manually already, and we do not want to change that                 if (!isset($optionData['position']) && !$option->getId()) {
                    $option->setPosition($optionPosition++);
                }
                $allOptions[] = $option;
                
Home | Imprint | This part of the site doesn't use cookies.