Pimcore\Model\Object\Data\KeyValue::setValueWithKeyId PHP Метод

setValueWithKeyId() публичный Метод

public setValueWithKeyId ( $keyId, $value )
$keyId
$value
    public function setValueWithKeyId($keyId, $value)
    {
        $cleanedUpValues = [];
        foreach ($this->arr as $entry) {
            if ($entry['key'] != $keyId) {
                $cleanedUpValues[] = $entry;
            }
        }
        $this->arr = $cleanedUpValues;
        if (!is_array($value)) {
            $value = [$value];
        }
        foreach ($value as $v) {
            $pair = [];
            $pair["key"] = $keyId;
            $pair["value"] = $v;
            $pair["translated"] = $this->getTranslatedValue($keyId, $v);
            $this->arr[] = $pair;
        }
    }