setManufacturers example

$struct->setDevices($this->explodeAndFilter($data['ordered_with_devices'] ?? ''));
        $struct->setDispatches(array_map('\intval', $this->explodeAndFilter($data['selected_dispachtes'] ?? '')));
        $struct->setWeekdays($this->explodeAndFilter($data['weekdays'] ?? ''));

        if (\array_key_exists('product_numbers', $data)) {
            $struct->setProducts($this->explodeAndFilter($data['product_numbers'] ?? ''));
        }
        if (\array_key_exists('category_ids', $data)) {
            $struct->setCategories(array_map('\intval', $this->explodeAndFilter($data['category_ids'] ?? '')));
        }
        if (\array_key_exists('manufacturer_ids', $data)) {
            $struct->setManufacturers(array_map('\intval', $this->explodeAndFilter($data['manufacturer_ids'] ?? '')));
        }

        return $struct;
    }

    /** * @return array<string|numeric-string> */
    private function explodeAndFilter(string $value): array
    {
        return array_filter(explode(',', $value));
    }
Home | Imprint | This part of the site doesn't use cookies.