Yii Framework Forum: YiiMongoDBSuite Nested Embedded documents - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

YiiMongoDBSuite Nested Embedded documents Rate Topic: -----

#1 User is offline   Mayur Ahir 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 21
  • Joined: 08-July 11

Posted 01 October 2011 - 04:46 AM

Hi Guys,
I have structure like this,

{User extends EMongoDocument

{CompensationBasic extends EMongoEmbeddedDocument

{CompensationAllowances extends EMongoEmbeddedDocument
type:
amout

}
{CompensationDeductions extends EMongoEmbeddedDocument
type:
amout

}

}

}

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 {
.
.
.
} 


0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users