phptools-docs icon indicating copy to clipboard operation
phptools-docs copied to clipboard

Type of Eloquent model's morphOne relationship cant be inferred in HyperF

Open Hanmo123 opened this issue 4 months ago • 1 comments

I am using HyperF and its ORM is based on Eloquent.

This is my model definition:

class CpsInstance extends AbstractProductInstance implements HourlyPostPaidProductInstance
{
    public function instance()
    {
        return $this->morphOne(Instance::class, 'product_instance', 'product_class', 'id');
    }
}

and access instance in service

$instance = $productInstance->instance;

it shows:

Image

while other non-morphOne relationships are normal but are mixed type(is there a way to infer correctly in hyperf?)

Image

Hanmo123 avatar Aug 02 '25 07:08 Hanmo123