Open nime11 opened 1 year ago
The code is written correctly, as the input is variadic (notice the ...
before $variableParameters
).
If you know the parameters and they don't change, you can hard code them
$product->setVariableParameters('one', 'two', 'three');
Most often you get an array from entity or somewhere, in that case, this is the way to use the function
$myParameters = ['one', 'two', 'three'];
$product->setVariableParameters(...$myParameters);
Hi, on ProductRequest.php you have one bug on function setVariableParameters it set that you need to send string to a function, but if you want to send multiple parameter you need to send array. WRONG:
public function setVariableParameters(string ...$variableParameters): void { $this->variableParameters = $variableParameters; }
RIGHT:public function setVariableParameters(array...$variableParameters): void { $this->variableParameters = $variableParameters; }