Revision #8 has been created by Maurizio Domba Cerin on Aug 3, 2012, 9:38:34 AM with the memo:
fixed code ident
« previous (#7)
Changes
Title
unchanged
How to use Multiple instances of the same model in the same form
Category
unchanged
How-tos
Yii version
unchanged
Tags
unchanged
Multiple instances of the same model in the same form, Multiple instances of the same model, Two instances of the same model
Content
changed
[...]
// Set attribute for user data
$model->attributes=$_POST['User'];
// Validate all three model
$valid=$addressModel_1->validate();
$valid=$addressModel_2->validate() && $valid;
$valid=$model->validate() && $valid;
if($valid)[...]
// Validate all three model
$valid=$addressModel_1->validate();
$valid=$addressModel_2->validate() && $valid;
$valid=$model->validate() && $valid;
if($valid)
{
$addressModel_1->save();
$addressModel_2->save();[...]