In my model i defined the behaviors() like this:
public function behaviors()
{
return array(
'embeddedArrays' => array(
'class'=>'ext.YiiMongoDbSuite.extra.EEmbeddedArraysBehavior',
'arrayPropertyName'=>'address', // name of property, that will be used as an array
'arrayDocClassName'=>'UserAddress' // class name of embedded documents in array
),
);
}
Also i made a model UserAddress.php and in the view file(_form.php), i gave as:
<div class="row">
<?php echo $form->labelEx($user->address[0],'city'); ?>
<?php echo $form->textField($user->address[0],'city'); ?>
<?php echo $form->error($user->address[0],'city'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($user->address[0],'zip'); ?>
<?php echo $form->textField($user->address[0],'zip'); ?>
<?php echo $form->error($user->address[0],'zip'); ?>
</div>
<div class="row">
<?php echo $form->labelEx($user->address[0],'street'); ?>
<?php echo $form->textField($user->address[0],'street'); ?>
<?php echo $form->error($user->address[0],'street'); ?>
</div>
But I get error as in the below image.
Can anyone help me on this?