Skip to content

eager loading problem #264

Open
Open
@veneliniliev

Description

@veneliniliev

I have a problem in the following case and with eager loading:

two fields with the same type:

HasOne::make('metric')->type('inventory-metrics'),
HasOne::make('metric-service', 'metricService')->type('inventory-metrics'),

in model:

public function metric(): HasOne
{
return $this->hasOne(Metric::class, 'id', 'metric_id');
}
public function metricService(): HasOne
{
return $this->hasOne(Metric::class, 'id', 'metric_service_id');
}

in AppServiceProvider I have Model::preventLazyLoading()

I include both relations in the query!

include=metric,metric-service

and throw an exception: Attempted to lazy load [metric] on model

Originally posted by @veneliniliev in #263 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs reproductionCannot reproduce a bug someone has reported

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions