I am trying to customize the children field in the ResourceModel class for the case of Tree scheduler. I have groups as parents and they are containing users. I want to be able to customize the children field to be be of type Array<User> and to be able to switch the default property names same way I can do it for the parent class, eg.
/**
* Creates a model instance, used internally when data is set/added. Override this in a subclass to do your own custom
* conversion from data to record.
* @param {Object} data Json data
* @param {Boolean} [skipExpose] Supply true when batch setting to not expose properties multiple times
* @category Records
*/
createRecord(data, skipExpose = false) {
return new this.modelClass(data, this, null, skipExpose);
}
These params are declared in Model base class constructor and used for internal purposes, so not documented.
If you want to have different model classes in you array, you need to create records for that array by you own.
I see only data mapping in your code snippet. If it's enough for you, that's fine. As I understood from your first question, you want to create a User class instances (that I hope you defined somewhere) inside that array, so create instances in your loop.