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