public function getPrices() { return $this->hasMany(tPrice::className(), ['idExpense' => 'id']); }
public function testCreatePrice() { //simulate form input $post = ['tPrice' => ['Price' => '110.00', 'Cost' => '100.00', 'Discount' => '0', 'QuantityMeasure' => '796', 'Quantity' => '1']]; $price = new tPrice(); $this->assertTrue($price->load($post), 'Load price POST data'); $this->assertTrue($price->validate(), 'Validate price'); $this->assertTrue($price->save(), 'Create price'); return $price; }