yii\db\ActiveRelationTrait::inverseOf PHP Method

inverseOf() public method

For example, an order has a customer, which means the inverse of the "customer" relation is the "orders", and the inverse of the "orders" relation is the "customer". If this property is set, the primary record(s) will be referenced through the specified relation. For example, $customer->orders[0]->customer and $customer will be the same object, and accessing the customer of an order will not trigger a new DB query. Use this method when declaring a relation in the ActiveRecord class: php public function getOrders() { return $this->hasMany(Order::className(), ['customer_id' => 'id'])->inverseOf('customer'); }
public inverseOf ( string $relationName )
$relationName string the name of the relation that is the inverse of this relation.
    public function inverseOf($relationName)
    {
        $this->inverseOf = $relationName;
        return $this;
    }