Converting array of objects

Hi guys, using hasmany()/hasone() relations of framwork will give me back following options




$modelsPoItem = $model->poItems;

var_dump($modelPoItem);





E:\xampp\htdocs\advanced\frontend\controllers\PoController.php:145:

object(frontend\models\PoItem)[203]

  private '_attributes' (yii\db\BaseActiveRecord) => 

    array (size=4)

      'po_item_no' => string 'po_item 6' (length=9)

      'quantity' => string '55' (length=2)

 	'po_id' => int 29

 	'id' => int 50



Using findAll-method of framework will give me back following options




$model_adressen = $this->findModel_adressen($id);

var_dump($model_adressen);




E:\xampp\htdocs\yii2_perswitch\frontend\modules\bewerber\controllers\BewerberController.php:223:

array (size=1)

  0 => 

    object(frontend\modules\kontakt\models\KontaktAdresse)[161]

      private '_attributes' (yii\db\BaseActiveRecord) => 

        array (size=20)

          'id' => int 6

          'id_e_kontakt' => int 5

          'id_kontakt_art' => string '1' (length=1)



Any ideas, how to convert second version into first ?

Got it by my own. using following code will transform array to object




$model_adressen = (object) $model_adressen



This thread can be closed as succesfully solved