Related data from object ID embedded in document on GridView

I have a document that looks like the following:




"_id": ObjectId("5564c405b3b74ef232120037"),

   "model": "Prototype Example",

   "mfg_name": "Example Company",

   "parts": [

     {

       "_id": ObjectId("5564c54bb3e452347000031"),

       "parts": ObjectId("5564c534b3b74e281700002f"),

       "quantity": "4",

       "req": "0",

       "alt_group": NumberInt(1),

       "desc": "" 

    },

     {

       "_id": ObjectId("5564cc13b3b74e941d000046"),

       "parts": ObjectId("5564cc0db3b74e941d000042") 

       "quantity": "1",

       "req": "0",

       "alt_group": NumberInt(2),

       "desc": ""

    },

}



I am using ArrayDataProvider to pass the embedded parts to a gridview which displays the above data without a problem, however, as the parts object ID is useless to a user, I want to get related data using the parts object id’s in the embedded parts subdocuments to show in gridview such as the parts.name etc.

I have tried using standard relations in the model, many workarounds and not so sophisticated tricks to do so with little success but I am wondering if there is any smart way to do this that doesn’t stray too far from core yii.

Thank you