Skip to content
This repository was archived by the owner on Nov 21, 2019. It is now read-only.
This repository was archived by the owner on Nov 21, 2019. It is now read-only.

Embedded doc containing embedded array of docs #57

Open
@jmper

Description

@jmper

With the following configuration:

class Test extends EMongoDocument {
    public function embeddedDocuments() {
        return array('test1' => 'Test1'),
    }
}

class Test1 extends EMongoEmbeddedDocument {
    public $test2;

    public function behaviors() {
        return array(
            'test2Behavior => array(
                'class'=>'ext.mongodb.extra.EEmbeddedArraysBehavior',
                'arrayPropertyName'=>'test2',       // name of property, that will be used as an array
                'arrayDocClassName'=>'Test2'    // class name of embedded documents in array
            ),
        ),
    }
}

class Test2 extends EMongoEmbeddedDocument {
    public $property1;
}

I cannot access:

$test = Test::model()->findByPk($id);
$val = $test->test1->test2[0]->property1;

actually I can do the following:

$val = $test->test1->test2[0]['property1'];

i.e. arrays are not being converted to objects.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions