Hi, I looking for a solution to map collections with subclasses for phalcon orm with mongodb. Saving of data is not a problem if the properties of a class is public or similar. But on selection collection by find or findone i always get arrays as data not the subclasses. How can I define this kind of mapping.

Example

// ORM Collection class by Phalcon
class BaseCollection extend Collection {
    public $name;
    public $otherClass;
    public $listOfClasses = array();
}

// simple class as child element inside the collection
class SubClass {
    $type = 'x';
    $others = 1212;
}

// example save
$base = new BaseCollection();
$base->name = 'basecollection';
$base->otherClass = new SubClass();
$base->listOfClasses[] = new SubClass();
$base->listOfClasses[] = new SubClass();

$base->save();

$searchResultSingleBaseClass = BaseCollection::findOne(['name' => 'basecollection']);

// result

$searchResultSingleBaseClass {
    name: 'basecollection',
    otherClass: [
        type: 'x',
        others: 1212
    ],
    listOfClasses: [
        [
            type: 'x',
            others: 1212
        ],
        ......
    ]
}

Do anyone have a tip for me to define this structure.