public function up() { $category = StoreCategory::model()->findByPk(2); Product::updateType($category); }
public static function updateType($category) { $categories = StoreCategory::model()->findAllByAttributes(array('parent_id' => $category->id)); if (isset($categories)) { foreach ($categories as $cat) { $cat->type = 'uslugi'; $cat->update(); Product::updateType($cat); } } }