/** * Creates copy of EAV attributes * * @param StoreProduct $original * @param StoreProduct $copy */ protected function copyAttributes(StoreProduct $original, StoreProduct $copy) { $attributes = $original->getEavAttributes(); if (!empty($attributes)) { foreach ($attributes as $key => $val) { Yii::app()->db->createCommand()->insert('StoreProductAttributeEAV', array('entity' => $copy->id, 'attribute' => $key, 'value' => $val)); } } }