src/Observers/CatalogAttributeUpdateObserver.php
protected function initializeAttribute(array $attr)
    {

        // try to load the EAV catalog attribute with the attribute code
        if ($attribute = $this->loadCatalogAttribute($attr[MemberNames::ATTRIBUTE_ID])) {
            // unserialize the additional data value if available
            if (is_array($attribute[MemberNames::ADDITIONAL_DATA]) && $attribute[MemberNames::ADDITIONAL_DATA] !== null) {
                // merge the additional data if available
                $attribute[MemberNames::ADDITIONAL_DATA] = array_merge(
                    $attr[MemberNames::ADDITIONAL_DATA],
                    json_decode($attribute[MemberNames::ADDITIONAL_DATA])
                );
            } elseif (!is_array($attribute[MemberNames::ADDITIONAL_DATA]) && $attribute[MemberNames::ADDITIONAL_DATA] !== null) {
                // unserialize and override the additional data
                $attribute[MemberNames::ADDITIONAL_DATA] = json_decode($attribute[MemberNames::ADDITIONAL_DATA]);
            } else {
                // nothing here
            }

            // merge the attributes into the entity
            return $this->serializeAdditionalData($this->mergeEntity($attribute, $attr));
        }

        //  serialize the additional data and return the attributes
        return parent::initializeAttribute($attr);
    }
protected function initializeAttribute(array $attr)
    {

        // try to load the EAV catalog attribute with the attribute code
        if ($attribute = $this->loadCatalogAttribute($attr[MemberNames::ATTRIBUTE_ID])) {
            // unserialize the additional data value if available
            if (is_array($attribute[MemberNames::ADDITIONAL_DATA]) && $attribute[MemberNames::ADDITIONAL_DATA] !== null) {
                // merge the additional data if available
                $attribute[MemberNames::ADDITIONAL_DATA] = array_merge(
                    $attr[MemberNames::ADDITIONAL_DATA],
                    json_decode($attribute[MemberNames::ADDITIONAL_DATA])
                );
            } elseif (!is_array($attribute[MemberNames::ADDITIONAL_DATA]) && $attribute[MemberNames::ADDITIONAL_DATA] !== null) {
                // unserialize and override the additional data
                $attribute[MemberNames::ADDITIONAL_DATA] = json_decode($attribute[MemberNames::ADDITIONAL_DATA]);
            } else {
                // nothing here
            }

            // merge the attributes into the entity
            return $this->serializeAdditionalData($this->mergeEntity($attribute, $attr));
        }

        //  serialize the additional data and return the attributes
        return parent::initializeAttribute($attr);
    }
Initialize the attribute with the passed attributes and returns an instance.

@param array $attr The attribute attributes

@return array The initialized attribute