When trying to handle media via the admin api I came across the next exception:
[Argument 1 passed to Shopware\Core\Framework\DataAbstractionLayer\Write\DataStack\KeyValuePair::__construct() must be of the type string, int given]
If I take a look at the file where the KeyValuePair class is called i see the next code:
foreach ($originalData as $key => $value) {
$this->data[$key] = new KeyValuePair($key, $value, true);
}
In addition to the fact that the class is deprecated it asks for a string
$key in the constructor:
class KeyValuePair
{
/**
* @var string
*/
private $key;
private $value;
/**
* @var bool
*/
private $isRaw;
public function __construct(string $key, $value, bool $isRaw)
{
$this->key = $key;
$this->value = $value;
$this->isRaw = $isRaw;
}
public function getKey(): string
{
return $this->key;
}
public function getValue()
{
return $this->value;
}
public function isRaw(): bool
{
return $this->isRaw;
}
public function setValue($value): void
{
$this->isRaw = false;
$this->value = $value;
}
}
Does someone knows how to fix this or how to make sure this deprecated class is not used anymore?