Skip to content

Sub resources are lazy loaded (this throws a Laravel error) #7166

Open
@Barbapapazes

Description

@Barbapapazes

API Platform version(s) affected: 4.1

Description

In a Laravel application, if the strict mode (https://laravel-news.com/shouldbestrict) is applied to models, the collection endpoints throws the following error:

Attempted to lazy load [...] on model [App\\Models\\...] but lazy loading is disabled.

How to reproduce

Create a Laravel application, add a model, a second model with a foreign key and add Model::shouldBeStrict() within the boot method of the service provider.

Possible Solution

Trying to not lazy load the sub resources?

Additional Context

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions