Example #1
0
    var $fields = array('price' => array(DT_AMOUNT, true));
}
/** 1.0. Clear out the database */
DB::execute("TRUNCATE combination");
DB::execute("TRUNCATE material");
DB::execute("TRUNCATE product");
DB::execute("TRUNCATE company");
/** 1.1. Create a new company */
$company = new Company();
$company->name = 'Testowa S.A.';
$company->save();
/** 1.2. Check if successfully created */
debug($company->load());
/** 1.3. Add a new product */
$product = new Product();
$product->belongs_to($company);
$product->name = 'Kanapa trzydrzwiowa';
$product->save();
/** 1.4. Check if successfully created */
debug($product->load());
/** 1.5. Create two new materials */
$mat_1 = new Material();
$mat_1->belongs_to($company);
$mat_1->name = 'Skóra';
$mat_1->save();
$mat_2 = new Material();
$mat_2->belongs_to($company);
$mat_2->name = 'Drewno brzozowe';
$mat_2->save();
/** 1.6. Check if materials successfully created */
debug($mat_1->load());