Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[11.x] Deprecate Factory::$modelNameResolver #54736

Merged

Conversation

samlev
Copy link
Contributor

@samlev samlev commented Feb 21, 2025

Renaming the $modelNameResolver property entirely in #54644 was a backwards compatibility break for any user-land and 3rd-party code that happened to touch the original property (see #54665, #54698). While it was a protected, static property inside a framework class, it's a relatively high-touch interface as most developers will extend the Factory class, and it's reasonable to assume that there is going to be code out there which touches the model resolver directly.

This PR re-introduces the original property as a fallback without affecting the new methods, but marks it the property as deprecated so that developers and third parties have a chance to migrate correctly without having to avoid other Laravel updates >=v11.42.0.

The doesn't need to be migrated to 12.x - it's a deprecation, and any external libraries that touch the property can handle the change in their migration to supporting 12.x. For the vast majority of users the property change would appear to be a be a low-no impact change, but for anyone that's using any code or libraries that happen to touch the $modelNameResolver property on factories, this was a BC break that blows up primarily testing environments.

Instead of removing the `$modelNameResolver` property entirely,
 which breaks any user-land and 3rd-party uses of it,
 this re-introduces the original property, but marks it as
 deprecated so that developers have a chance to migrate
 correctly without having to avoid other Laravel updates.
@taylorotwell taylorotwell merged commit 0054c26 into laravel:11.x Feb 21, 2025
46 checks passed
@samlev samlev deleted the bugfix/11.x_factory_namespace_reversion branch February 21, 2025 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants