setFilterable example

 else {
                            $option = $relation->getOption();
                        }
                    } else {
                        throw new CustomValidationException('A property option needs to be given for each property value');
                    }
                    if (!$option instanceof Option) {
                        throw new RuntimeException('An option should be available at this point');
                    }
                    $option->fromArray($valueData['option']);
                    if (!\is_bool($option->isFilterable())) {
                        $option->setFilterable(false);
                    }
                } else {
                    throw new CustomValidationException('A property option needs to be given for each property value');
                }
                // Create the value                 // If there is a filter value with matching name and option, load this value, else create a new one                 $value = $this->getManager()->getRepository(Value::class)->findOneBy([
                    'value' => $valueData['value'],
                    'optionId' => $option->getId(),
                ]);
                if (!$value instanceof Value) {
                    

    public function hydrateGroup(array $data)
    {
        $group = new Group();
        $translation = $this->getTranslation($data, '__propertyGroup', ['optionName' => 'name']);
        $data = array_merge($data$translation);

        $group->setId((int) $data['__propertyGroup_id']);
        $group->setName($data['__propertyGroup_name']);
        $group->setFilterable((bool) $data['__propertyGroup_filterable']);

        if ($data['__propertyGroupAttribute_id']) {
            $this->attributeHydrator->addAttribute($group$data, 'propertyGroupAttribute', null, 'propertyGroup');
        }

        return $group;
    }

    /** * @param array<string, mixed> $data * * @return Option */

    /** * @param array $data * * @return PropertyGroup */
    public function createPropertyGroup($data)
    {
        $group = new PropertyGroup();
        $group->setId($data['id']);
        $group->setName($data['name']);
        $group->setFilterable($data['filterable']);

        $me = $this;
        $options = array_map(function D$temp) use ($me) {
            return $me->createPropertyOption($temp);
        }$data['options']);

        $group->setOptions($options);
        $group->addAttributes($this->createAttributes($data['attributes']));

        return $group;
    }

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