<?php

use yii\db\Schema;
use yii\db\Migration;
use common\models\Product;
use common\models\ProductCategory;

class m160124_235346_add_product_buntetes extends Migration
{
    public function up()
    {
		$productCategory = new ProductCategory();
		$productCategory->name = "Büntetések";
		$productCategory->status = ProductCategory::STATUS_ACTIVE;
		
		$productCategory->save(false);
		
		$product = new Product();
		$product->name = "Büntetés Szerződés 3000 ft";
		$product->product_number = "buntetes3000";
		$product->id_account = 1;
		$product->purchase_price = 0;
		$product->sale_price = 3000;
		$product->id_product_category = $productCategory->id_product_category;
		$product->save(false);
		
		
    }

    public function down()
    {
    }

    /*
    // Use safeUp/safeDown to run migration code within a transaction
    public function safeUp()
    {
    }

    public function safeDown()
    {
    }
    */
}
