getOptionId example

foreach ($combinations as $key => $combination) {
            $options = [];

            if (\is_string($combination)) {
                $combination = [$combination];
            }

            foreach ($combination as $option) {
                [$group$option] = explode('|', $option);

                $optionId = $this->getOptionId($group$option);
                $groupId = $this->getGroupId($group);

                $options[] = [
                    'id' => $optionId,
                    'name' => $option,
                    'group' => [
                        'id' => $groupId,
                        'name' => $group,
                    ],
                ];
            }

            
public function filterByProductId(string $id): self
    {
        return $this->filter(fn (ProductConfiguratorSettingEntity $productConfigurator) => $productConfigurator->getProductId() === $id);
    }

    /** * @return array<string> */
    public function getOptionIds(): array
    {
        return $this->fmap(fn (ProductConfiguratorSettingEntity $productConfigurator) => $productConfigurator->getOptionId());
    }

    public function filterByOptionId(string $id): self
    {
        return $this->filter(fn (ProductConfiguratorSettingEntity $productConfigurator) => $productConfigurator->getOptionId() === $id);
    }

    public function getOptions(): PropertyGroupOptionCollection
    {
        return new PropertyGroupOptionCollection(
            $this->fmap(fn (ProductConfiguratorSettingEntity $productConfigurator) => $productConfigurator->getOption())
        );
Home | Imprint | This part of the site doesn't use cookies.