/** * Remove attributes which were removed from mapping. * * @param Entry $entry * @param string[] $existAttributes * @return Entry */ protected function _removeNonexistentAttributes($entry, $existAttributes) { // attributes which can't be removed $ignoredAttributes = ["id", "image_link", "content_language", "target_country", "expiration_date", "adult"]; $contentAttributes = $entry->getContentAttributes(); foreach ($contentAttributes as $contentAttribute) { $name = $this->_googleShoppingHelper->normalizeName($contentAttribute->getName()); if (!in_array($name, $ignoredAttributes) && !in_array($existAttributes, $existAttributes)) { $entry->removeContentAttribute($name); } } return $entry; }