Multiply fields (from another table)

Hello! I am trying to calculate fields (multiply) from another table.

I want to multiply unit price and quantity.

Unit price is coming from the Product Inventory Table, while Quantity is from the Order table.

I calculated it using run time, but I just can’t figure out how to call or return the data from another table.

Here’s my code snippet:

Order.php

public function getTotal()

 {

$prod = ‘productinventory.price’;

    return ($this->$prod * $this->num_items);


}

I called it using: (view.php -> Order)

[

        'attribute' => 'amount',


        'value' => $model->getTotal(),


        ],

I am getting this error: Getting unknown property: backend\models\Order::productinventory.price

num_items is the quantity

while productinventory.price is the price coming from Product Inventory Table.