/** * Sets each value from data to entity Varien_Object using setter method. * * @param Varien_Object $entity * @param array $data */ protected function _setDataUsingMethods($entity, array $data) { foreach ($data as $property => $value) { $entity->setDataUsingMethod($property, $value); } }
/** * Update a resource * * @param Varien_Object $resource * @param string[] $attributeCodes * @param mixed[] $data * * @return $this */ protected function saveResourceAttributes(Varien_Object $resource, array $attributeCodes, array $data) { $attributeCodes = array_diff($attributeCodes, $this->manualAttributes); $attributeCodes = array_combine($attributeCodes, $attributeCodes); $attributeCodes = array_merge($attributeCodes, array_intersect_key($this->attributeMap, $attributeCodes)); foreach (array_intersect_key($data, $attributeCodes) as $externalKey => $value) { $resource->setDataUsingMethod($attributeCodes[$externalKey], $value); } return $this; }