Model return array

I’m developing a grid and I need to display the record from the DB that has many results.

For example I want to get shipped items that contains job_id 1. So the Shipped Items table has many records with id 1 and I want to display the quantity of those items in my grid.

This is what I have so far:

Model:


public function getShippedItems()

    {

        return $this->hasMany(ShippedItems::className(), ['job_id' => 'id']);

    }

My view:




[

   'value'=>'shippedItems',

]



And this is the error that I’m getting:

htmlspecialchars() expects parameter 1 to be string, array given

What am I missing?

Thanks

You have to specify which field name u want to display.

eg:




[

   'value'=>'shippedItems.shippedName',

]



Rups thanks for the help but didn’t work.

I have an array in my database of shipped items that belongs to that job_id, I need to display the length of that array. Makes sense?

means in db u have job id: 1,3,4

u want to display this lenght of that array.