Skip to content

Factory does not have a property named modelNameResolver #54698

Closed
@samlev

Description

@samlev

Laravel Version

11.43.0

PHP Version

8.3.16

Database Driver & Version

No response

Description

In PR #54644 the static property $modelNameResolver on Illuminate\Database\Eloquent\Factories\Factory was renamed to $modelNameResolvers, and given a default value of an array.

This makes sense in context, but was a BC break for any other library or code used that property. I've just encountered this due to internachi/modular suddenly breaking in my test suite (which comes in via hirethunk/verbs). This is the library that I encountered that has the issue, but I suspect that it's not the only one.

I'm not sure what the best resolution is here as the new use has also changed the nature of the property, but I suspect that the solution will be returning the original property and providing a method which uses it as a fallback.

Steps To Reproduce

  • Run composer require internachi/modular
  • Attempt to do anything that uses a model factory.

Get error:

Class Illuminate\Database\Eloquent\Factories\Factory does not have a property named modelNameResolver

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