-
Notifications
You must be signed in to change notification settings - Fork 21
Open
Description
I have a problem with saving related model.
Order model :
'customer' => array(self::HAS_ONE, 'Customer', array('id' => 'customer_id')),
Customer model:
'orders' => array(self::HAS_MANY, 'Order', 'customer_id'),
Controller:
if (isset($_POST['Order'])) {
$model->attributes = $_POST['Order'];
if (isset($_POST['Customer']))
$model->customer->setAttributes($_POST['Customer']);
if ($model->withRelated->save(true, array('customer')))
$this->redirect(array('admin'));
}
After save customer_id property of Order is NULL.
Metadata
Metadata
Assignees
Labels
No labels