public static function getMage2AttributeSetId($mage1AttrSetId, $entity_type_code = null) { $id = null; if (isset($mage1AttrSetId)) { $cacheId = "attribute_set_id2_{$mage1AttrSetId}_{$entity_type_code}"; $val = Yii::app()->cache->get($cacheId); if (!$val) { $model1 = Mage1AttributeSet::model()->findByPk($mage1AttrSetId); if ($model1) { if (!$entity_type_code) { $entity_type_code = self::PRODUCT_TYPE_CODE; } $entity_type_id2 = MigrateSteps::getMage2EntityTypeId($entity_type_code); $model2 = Mage2AttributeSet::model()->find("entity_type_id = {$entity_type_id2} AND attribute_set_name = '{$model1->attribute_set_name}'"); if ($model2) { $id = $model2->attribute_set_id; } } //save to cache for later Yii::app()->cache->set($cacheId, $id, 86400); // one day } else { $id = $val; } } return $id; }
public static function getMage2AttributeSetId($mage1AttrSetId, $entity_type_code = null) { $id = null; if (isset($mage1AttrSetId)) { $model1 = Mage1AttributeSet::model()->findByPk($mage1AttrSetId); if ($model1) { if (!$entity_type_code) { $entity_type_code = self::PRODUCT_TYPE_CODE; } $entity_type_id2 = MigrateSteps::getMage2EntityTypeId($entity_type_code); $model2 = Mage2AttributeSet::model()->find("entity_type_id = {$entity_type_id2} AND attribute_set_name = '{$model1->attribute_set_name}'"); if ($model2) { $id = $model2->attribute_set_id; } } } return $id; }