Hi Guys,
I have structure like this,
{User extends EMongoDocument
[indent]
{CompensationBasic extends EMongoEmbeddedDocument
[indent]
{CompensationAllowances extends EMongoEmbeddedDocument
[indent]type:
amout[/indent]
}
{CompensationDeductions extends EMongoEmbeddedDocument
[indent]type:
amout[/indent]
}
[/indent]
}
[/indent]
}
But I always get error as
Event "CompensationBasic.onBeforeSave" is not defined.
Please help me…
Also in my models I have
class User extends EMongoDocument { // User Model
public $compensation;
.
.
public function behaviors() {
return array(
array(
'class' => 'ext.YiiMongoDbSuite.extra.EEmbeddedArraysBehavior',
'arrayPropertyName' => 'compensation', // name of property, that will be used as an array
'arrayDocClassName' => 'CompensationBasic' // class name of embedded documents in array
),
);
}
.
.
}
class CompensationBasic extends EMongoEmbeddedDocument {
public $allowances;
public $deductions;
.
.
.
public function behaviors() {
return array(
array(
'class' => 'ext.YiiMongoDbSuite.extra.EEmbeddedArraysBehavior',
'arrayPropertyName' => 'allowances', // name of property, that will be used as an array
'arrayDocClassName' => 'CompensationAllowances' // class name of embedded documents in array
),
array(
'class' => 'ext.YiiMongoDbSuite.extra.EEmbeddedArraysBehavior',
'arrayPropertyName' => 'deductions', // name of property, that will be used as an array
'arrayDocClassName' => 'CompensationDeductions' // class name of embedded documents in array
),
);
}
.
.
}
class CompensationAllowances extends EMongoEmbeddedDocument {
.
.
.
}
class CompensationDeductions extends EMongoEmbeddedDocument {
.
.
.
}