model A has one model B has one model C

I has model A, B, C

model A has relation


  public function getBproperty()

    {

        return $this->hasOne(B::className(), ['id' => 'idB']);

    }

so in model ASearch search method i has this join


$query->joinWith(['bproperty']);

so then in index view file of model A, in the grid view data column i just write bproperty.propertyname to get value from model B

Model B has relation


public function getCproperty()

    {

        return $this->hasOne(C::className(), ['id' => 'idC']);

    }

So i want to show model C property value in the view index file of model A. How can i retrieve the value?

I dont know how to write relation of model A to model C.


$data = $query->joinWith(['bproperty.cproperty']);

//get your value in view if the relation are hasOne Relation that you mentioned above 

$data->bproperty->cproperty->value ;