class Model_Product_Budget extends Orm\Model { protected static $_properties = array('id','product_code','budget_id','price','qty','created_at','updated_at',); protected static $_table_name = 'products_budgets'; protected static $_belongs_to = array('product', 'budget'); } class Model_Budget extends Orm\Model { protected static $_belongs_to = array('client'); protected static $_has_many = array('product_budget'); protected static $_many_many = array( 'product' => array( 'table_through' => 'products_budgets', 'key_through_from' => 'budget_id', 'key_through_to' => 'product_code', 'key_to' => 'product_code', 'cascade_save' => false ) ); protected static $_properties = array('id', 'client_id', 'message', 'subtotal', 'discount', 'total', 'created_at', 'updated_at', 'sent','hash',); } class Model_Client extends Orm\Model { protected static $_has_many = array('budget'); protected static $_properties = array('id','first_name','last_name','email','company','phone','address_street','address_number','city','created_at', 'updated_at','cuit',); }
$budget = Model_Budget::find($id); $budget->subtotal = $subtotal; $budget->total = $total; $budget->discount = $discount; $budget->save();
It looks like you're new here. If you want to get involved, click one of these buttons!